prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  make the fuse logic separated out of graph
  For now, the fuse logic is adhere to the graph.pyx, we should separate the logic out of graph, and make it standalone, so we can do some unit test on the fuse.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `setup.py`
  Content:
  ```
  1 # Copyright 1999-2017 Alibaba Group Holding Ltd.
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 #
  7 #      http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 
  15 import os
  16 import sys
  17 from setuptools import setup, find_packages, Extension
  18 
  19 import numpy as np
  20 from Cython.Build import cythonize
  21 from Cython.Distutils import build_ext
  22 
  23 repo_root = os.path.dirname(os.path.abspath(__file__))
  24 
  25 try:
  26     execfile
  27 except NameError:
  28     def execfile(fname, globs, locs=None):
  29         locs = locs or globs
  30         exec(compile(open(fname).read(), fname, "exec"), globs, locs)
  31 
  32 version_file_path = os.path.join(repo_root, 'mars', '_version.py')
  33 version_ns = {'__file__': version_file_path}
  34 execfile(version_file_path, version_ns)
  35 
  36 requirements = []
  37 with open(os.path.join(repo_root, 'requirements.txt'), 'r') as f:
  38     requirements.extend(f.read().splitlines())
  39 
  40 
  41 extra_requirements=[]
  42 with open(os.path.join(repo_root, 'requirements-extra.txt'), 'r') as f:
  43     extra_requirements.extend(f.read().splitlines())
  44 
  45 
  46 long_description = None
  47 if os.path.exists(os.path.join(repo_root, 'README.rst')):
  48     with open(os.path.join(repo_root, 'README.rst')) as f:
  49         long_description = f.read()
  50 
  51 
  52 if os.path.exists(os.path.join(repo_root, '.git')):
  53     git_info = version_ns['get_git_info']()
  54     if git_info:
  55         with open(os.path.join(repo_root, 'mars', '.git-branch'), 'w') as git_file:
  56             git_file.write('%s %s' % git_info)
  57 
  58 
  59 if 'CI_MODE' in os.environ:
  60     for root, dirs, files in os.walk(repo_root):
  61         for fn in files:
  62             if not fn.endswith('.pyx'):
  63                 continue
  64             path = os.path.join(root, fn)
  65             with open(path, 'rb') as f:
  66                 src = f.read()
  67             with open(path, 'wb') as f:
  68                 f.write(b'# cython: linetrace=True' + os.linesep.encode('utf-8') + src)
  69 
  70 
  71 if 'MSC' in sys.version:
  72     extra_compile_args = ['/Ot', '/I' + os.path.join(repo_root, 'misc')]
  73     if 'CI_MODE' in os.environ:
  74         extra_compile_args.extend(['/DCYTHON_TRACE_NOGIL=#1', '/DCYTHON_TRACE=#1'])
  75     extension_kw = {'extra_compile_args': extra_compile_args}
  76 else:
  77     extra_compile_args = ['-O3']
  78     if 'CI_MODE' in os.environ:
  79         extra_compile_args.extend(['-DCYTHON_TRACE_NOGIL=1', '-DCYTHON_TRACE=1'])
  80     extension_kw = {'extra_compile_args': extra_compile_args}
  81 extension_kw['include_dirs'] = [np.get_include()]
  82 extensions = [
  83     Extension('mars.graph', ['mars/graph.pyx'], **extension_kw),
  84     Extension('mars.utils_c', ['mars/utils_c.pyx'], **extension_kw),
  85     Extension('mars.lib.gipc', ['mars/lib/gipc.pyx'], **extension_kw),
  86     Extension('mars.actors.core', ['mars/actors/core.pyx'], **extension_kw),
  87     Extension('mars.actors.distributor', ['mars/actors/distributor.pyx'], **extension_kw),
  88     Extension('mars.actors.cluster', ['mars/actors/cluster.pyx'], **extension_kw),
  89     Extension('mars.actors.pool.messages', ['mars/actors/pool/messages.pyx'], **extension_kw),
  90     Extension('mars.actors.pool.utils', ['mars/actors/pool/utils.pyx'], **extension_kw),
  91     Extension('mars.actors.pool.gevent_pool', ['mars/actors/pool/gevent_pool.pyx'], **extension_kw),
  92     Extension('mars.serialize.core', ['mars/serialize/core.pyx'], **extension_kw),
  93     Extension('mars.serialize.pbserializer', ['mars/serialize/pbserializer.pyx'], **extension_kw),
  94     Extension('mars.serialize.jsonserializer', ['mars/serialize/jsonserializer.pyx'], **extension_kw),
  95 ]
  96 
  97 
  98 setup_options = dict(
  99     name='pymars',
  100     version=version_ns['__version__'],
  101     description='MARS: a tensor-based unified framework for large-scale data computation.',
  102     long_description=long_description,
  103     author='Qin Xuye',
  104     author_email='qin@qinxuye.me',
  105     maintainer='Qin Xuye',
  106     maintainer_email='qin@qinxuye.me',
  107     url='http://github.com/mars-project/mars',
  108     license='Apache License 2.0',
  109     classifiers=[
  110         'Operating System :: OS Independent',
  111         'Programming Language :: Python',
  112         'Programming Language :: Python :: 2',
  113         'Programming Language :: Python :: 2.7',
  114         'Programming Language :: Python :: 3',
  115         'Programming Language :: Python :: 3.5',
  116         'Programming Language :: Python :: 3.6',
  117         'Programming Language :: Python :: 3.7',
  118         'Programming Language :: Python :: Implementation :: CPython',
  119         'Topic :: Software Development :: Libraries',
  120     ],
  121     packages=find_packages(exclude=('*.tests.*', '*.tests')),
  122     include_package_data=True,
  123     scripts=['scripts/mars-scheduler', 'scripts/mars-worker', 'scripts/mars-web'],
  124     install_requires=requirements,
  125     cmdclass={'build_ext': build_ext},
  126     ext_modules=cythonize(extensions),
  127     extras_require={'distributed': extra_requirements}
  128 )
  129 setup(**setup_options)
  130
  ```
  --- 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/setup.py b/setup.py
  --- a/setup.py
  +++ b/setup.py
  @@ -81,6 +81,7 @@
   extension_kw['include_dirs'] = [np.get_include()]
   extensions = [
       Extension('mars.graph', ['mars/graph.pyx'], **extension_kw),
  +    Extension('mars.fuse', ['mars/fuse.pyx'], **extension_kw),
       Extension('mars.utils_c', ['mars/utils_c.pyx'], **extension_kw),
       Extension('mars.lib.gipc', ['mars/lib/gipc.pyx'], **extension_kw),
       Extension('mars.actors.core', ['mars/actors/core.pyx'], **extension_kw),
  
verification_info: {"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -81,6 +81,7 @@\n extension_kw['include_dirs'] = [np.get_include()]\n extensions = [\n     Extension('mars.graph', ['mars/graph.pyx'], **extension_kw),\n+    Extension('mars.fuse', ['mars/fuse.pyx'], **extension_kw),\n     Extension('mars.utils_c', ['mars/utils_c.pyx'], **extension_kw),\n     Extension('mars.lib.gipc', ['mars/lib/gipc.pyx'], **extension_kw),\n     Extension('mars.actors.core', ['mars/actors/core.pyx'], **extension_kw),\n", "issue": "make the fuse logic separated out of graph\nFor now, the fuse logic is adhere to the graph.pyx, we should separate the logic out of graph, and make it standalone, so we can do some unit test on the fuse.\n", "before_files": [{"content": "# Copyright 1999-2017 Alibaba Group Holding Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport os\nimport sys\nfrom setuptools import setup, find_packages, Extension\n\nimport numpy as np\nfrom Cython.Build import cythonize\nfrom Cython.Distutils import build_ext\n\nrepo_root = os.path.dirname(os.path.abspath(__file__))\n\ntry:\n    execfile\nexcept NameError:\n    def execfile(fname, globs, locs=None):\n        locs = locs or globs\n        exec(compile(open(fname).read(), fname, \"exec\"), globs, locs)\n\nversion_file_path = os.path.join(repo_root, 'mars', '_version.py')\nversion_ns = {'__file__': version_file_path}\nexecfile(version_file_path, version_ns)\n\nrequirements = []\nwith open(os.path.join(repo_root, 'requirements.txt'), 'r') as f:\n    requirements.extend(f.read().splitlines())\n\n\nextra_requirements=[]\nwith open(os.path.join(repo_root, 'requirements-extra.txt'), 'r') as f:\n    extra_requirements.extend(f.read().splitlines())\n\n\nlong_description = None\nif os.path.exists(os.path.join(repo_root, 'README.rst')):\n    with open(os.path.join(repo_root, 'README.rst')) as f:\n        long_description = f.read()\n\n\nif os.path.exists(os.path.join(repo_root, '.git')):\n    git_info = version_ns['get_git_info']()\n    if git_info:\n        with open(os.path.join(repo_root, 'mars', '.git-branch'), 'w') as git_file:\n            git_file.write('%s %s' % git_info)\n\n\nif 'CI_MODE' in os.environ:\n    for root, dirs, files in os.walk(repo_root):\n        for fn in files:\n            if not fn.endswith('.pyx'):\n                continue\n            path = os.path.join(root, fn)\n            with open(path, 'rb') as f:\n                src = f.read()\n            with open(path, 'wb') as f:\n                f.write(b'# cython: linetrace=True' + os.linesep.encode('utf-8') + src)\n\n\nif 'MSC' in sys.version:\n    extra_compile_args = ['/Ot', '/I' + os.path.join(repo_root, 'misc')]\n    if 'CI_MODE' in os.environ:\n        extra_compile_args.extend(['/DCYTHON_TRACE_NOGIL=#1', '/DCYTHON_TRACE=#1'])\n    extension_kw = {'extra_compile_args': extra_compile_args}\nelse:\n    extra_compile_args = ['-O3']\n    if 'CI_MODE' in os.environ:\n        extra_compile_args.extend(['-DCYTHON_TRACE_NOGIL=1', '-DCYTHON_TRACE=1'])\n    extension_kw = {'extra_compile_args': extra_compile_args}\nextension_kw['include_dirs'] = [np.get_include()]\nextensions = [\n    Extension('mars.graph', ['mars/graph.pyx'], **extension_kw),\n    Extension('mars.utils_c', ['mars/utils_c.pyx'], **extension_kw),\n    Extension('mars.lib.gipc', ['mars/lib/gipc.pyx'], **extension_kw),\n    Extension('mars.actors.core', ['mars/actors/core.pyx'], **extension_kw),\n    Extension('mars.actors.distributor', ['mars/actors/distributor.pyx'], **extension_kw),\n    Extension('mars.actors.cluster', ['mars/actors/cluster.pyx'], **extension_kw),\n    Extension('mars.actors.pool.messages', ['mars/actors/pool/messages.pyx'], **extension_kw),\n    Extension('mars.actors.pool.utils', ['mars/actors/pool/utils.pyx'], **extension_kw),\n    Extension('mars.actors.pool.gevent_pool', ['mars/actors/pool/gevent_pool.pyx'], **extension_kw),\n    Extension('mars.serialize.core', ['mars/serialize/core.pyx'], **extension_kw),\n    Extension('mars.serialize.pbserializer', ['mars/serialize/pbserializer.pyx'], **extension_kw),\n    Extension('mars.serialize.jsonserializer', ['mars/serialize/jsonserializer.pyx'], **extension_kw),\n]\n\n\nsetup_options = dict(\n    name='pymars',\n    version=version_ns['__version__'],\n    description='MARS: a tensor-based unified framework for large-scale data computation.',\n    long_description=long_description,\n    author='Qin Xuye',\n    author_email='qin@qinxuye.me',\n    maintainer='Qin Xuye',\n    maintainer_email='qin@qinxuye.me',\n    url='http://github.com/mars-project/mars',\n    license='Apache License 2.0',\n    classifiers=[\n        'Operating System :: OS Independent',\n        'Programming Language :: Python',\n        'Programming Language :: Python :: 2',\n        'Programming Language :: Python :: 2.7',\n        'Programming Language :: Python :: 3',\n        'Programming Language :: Python :: 3.5',\n        'Programming Language :: Python :: 3.6',\n        'Programming Language :: Python :: 3.7',\n        'Programming Language :: Python :: Implementation :: CPython',\n        'Topic :: Software Development :: Libraries',\n    ],\n    packages=find_packages(exclude=('*.tests.*', '*.tests')),\n    include_package_data=True,\n    scripts=['scripts/mars-scheduler', 'scripts/mars-worker', 'scripts/mars-web'],\n    install_requires=requirements,\n    cmdclass={'build_ext': build_ext},\n    ext_modules=cythonize(extensions),\n    extras_require={'distributed': extra_requirements}\n)\nsetup(**setup_options)\n", "path": "setup.py"}], "after_files": [{"content": "# Copyright 1999-2017 Alibaba Group Holding Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport os\nimport sys\nfrom setuptools import setup, find_packages, Extension\n\nimport numpy as np\nfrom Cython.Build import cythonize\nfrom Cython.Distutils import build_ext\n\nrepo_root = os.path.dirname(os.path.abspath(__file__))\n\ntry:\n    execfile\nexcept NameError:\n    def execfile(fname, globs, locs=None):\n        locs = locs or globs\n        exec(compile(open(fname).read(), fname, \"exec\"), globs, locs)\n\nversion_file_path = os.path.join(repo_root, 'mars', '_version.py')\nversion_ns = {'__file__': version_file_path}\nexecfile(version_file_path, version_ns)\n\nrequirements = []\nwith open(os.path.join(repo_root, 'requirements.txt'), 'r') as f:\n    requirements.extend(f.read().splitlines())\n\n\nextra_requirements=[]\nwith open(os.path.join(repo_root, 'requirements-extra.txt'), 'r') as f:\n    extra_requirements.extend(f.read().splitlines())\n\n\nlong_description = None\nif os.path.exists(os.path.join(repo_root, 'README.rst')):\n    with open(os.path.join(repo_root, 'README.rst')) as f:\n        long_description = f.read()\n\n\nif os.path.exists(os.path.join(repo_root, '.git')):\n    git_info = version_ns['get_git_info']()\n    if git_info:\n        with open(os.path.join(repo_root, 'mars', '.git-branch'), 'w') as git_file:\n            git_file.write('%s %s' % git_info)\n\n\nif 'CI_MODE' in os.environ:\n    for root, dirs, files in os.walk(repo_root):\n        for fn in files:\n            if not fn.endswith('.pyx'):\n                continue\n            path = os.path.join(root, fn)\n            with open(path, 'rb') as f:\n                src = f.read()\n            with open(path, 'wb') as f:\n                f.write(b'# cython: linetrace=True' + os.linesep.encode('utf-8') + src)\n\n\nif 'MSC' in sys.version:\n    extra_compile_args = ['/Ot', '/I' + os.path.join(repo_root, 'misc')]\n    if 'CI_MODE' in os.environ:\n        extra_compile_args.extend(['/DCYTHON_TRACE_NOGIL=#1', '/DCYTHON_TRACE=#1'])\n    extension_kw = {'extra_compile_args': extra_compile_args}\nelse:\n    extra_compile_args = ['-O3']\n    if 'CI_MODE' in os.environ:\n        extra_compile_args.extend(['-DCYTHON_TRACE_NOGIL=1', '-DCYTHON_TRACE=1'])\n    extension_kw = {'extra_compile_args': extra_compile_args}\nextension_kw['include_dirs'] = [np.get_include()]\nextensions = [\n    Extension('mars.graph', ['mars/graph.pyx'], **extension_kw),\n    Extension('mars.fuse', ['mars/fuse.pyx'], **extension_kw),\n    Extension('mars.utils_c', ['mars/utils_c.pyx'], **extension_kw),\n    Extension('mars.lib.gipc', ['mars/lib/gipc.pyx'], **extension_kw),\n    Extension('mars.actors.core', ['mars/actors/core.pyx'], **extension_kw),\n    Extension('mars.actors.distributor', ['mars/actors/distributor.pyx'], **extension_kw),\n    Extension('mars.actors.cluster', ['mars/actors/cluster.pyx'], **extension_kw),\n    Extension('mars.actors.pool.messages', ['mars/actors/pool/messages.pyx'], **extension_kw),\n    Extension('mars.actors.pool.utils', ['mars/actors/pool/utils.pyx'], **extension_kw),\n    Extension('mars.actors.pool.gevent_pool', ['mars/actors/pool/gevent_pool.pyx'], **extension_kw),\n    Extension('mars.serialize.core', ['mars/serialize/core.pyx'], **extension_kw),\n    Extension('mars.serialize.pbserializer', ['mars/serialize/pbserializer.pyx'], **extension_kw),\n    Extension('mars.serialize.jsonserializer', ['mars/serialize/jsonserializer.pyx'], **extension_kw),\n]\n\n\nsetup_options = dict(\n    name='pymars',\n    version=version_ns['__version__'],\n    description='MARS: a tensor-based unified framework for large-scale data computation.',\n    long_description=long_description,\n    author='Qin Xuye',\n    author_email='qin@qinxuye.me',\n    maintainer='Qin Xuye',\n    maintainer_email='qin@qinxuye.me',\n    url='http://github.com/mars-project/mars',\n    license='Apache License 2.0',\n    classifiers=[\n        'Operating System :: OS Independent',\n        'Programming Language :: Python',\n        'Programming Language :: Python :: 2',\n        'Programming Language :: Python :: 2.7',\n        'Programming Language :: Python :: 3',\n        'Programming Language :: Python :: 3.5',\n        'Programming Language :: Python :: 3.6',\n        'Programming Language :: Python :: 3.7',\n        'Programming Language :: Python :: Implementation :: CPython',\n        'Topic :: Software Development :: Libraries',\n    ],\n    packages=find_packages(exclude=('*.tests.*', '*.tests')),\n    include_package_data=True,\n    scripts=['scripts/mars-scheduler', 'scripts/mars-worker', 'scripts/mars-web'],\n    install_requires=requirements,\n    cmdclass={'build_ext': build_ext},\n    ext_modules=cythonize(extensions),\n    extras_require={'distributed': extra_requirements}\n)\nsetup(**setup_options)\n", "path": "setup.py"}]}