prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  [BUG] Build documentation fails if dipy is not installed
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `nipype/interfaces/dipy/base.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 """ Base interfaces for dipy """
  3 import os.path as op
  4 import numpy as np
  5 from nipype.interfaces.base import (traits, File, isdefined,
  6                                     BaseInterface, BaseInterfaceInputSpec)
  7 from ... import logging
  8 
  9 IFLOGGER = logging.getLogger('interface')
  10 
  11 HAVE_DIPY = True
  12 try:
  13     import dipy
  14 except ImportError:
  15     HAVE_DIPY = False
  16 
  17 
  18 def no_dipy():
  19     """ Check if dipy is available """
  20     global HAVE_DIPY
  21     return not HAVE_DIPY
  22 
  23 
  24 def dipy_version():
  25     """ Check dipy version """
  26     if no_dipy():
  27         return None
  28 
  29     return dipy.__version__
  30 
  31 
  32 class DipyBaseInterface(BaseInterface):
  33 
  34     """
  35     A base interface for py:mod:`dipy` computations
  36     """
  37     def __init__(self, **inputs):
  38         if no_dipy():
  39             IFLOGGER.error('dipy was not found')
  40             # raise ImportError('dipy was not found')
  41         super(DipyBaseInterface, self).__init__(**inputs)
  42 
  43 
  44 class DipyBaseInterfaceInputSpec(BaseInterfaceInputSpec):
  45     in_file = File(exists=True, mandatory=True, desc=('input diffusion data'))
  46     in_bval = File(exists=True, mandatory=True, desc=('input b-values table'))
  47     in_bvec = File(exists=True, mandatory=True, desc=('input b-vectors table'))
  48     b0_thres = traits.Int(700, usedefault=True, desc=('b0 threshold'))
  49     out_prefix = traits.Str(desc=('output prefix for file names'))
  50 
  51 
  52 class DipyDiffusionInterface(DipyBaseInterface):
  53 
  54     """
  55     A base interface for py:mod:`dipy` computations
  56     """
  57     input_spec = DipyBaseInterfaceInputSpec
  58 
  59     def _get_gradient_table(self):
  60         bval = np.loadtxt(self.inputs.in_bval)
  61         bvec = np.loadtxt(self.inputs.in_bvec).T
  62         from dipy.core.gradients import gradient_table
  63         gtab = gradient_table(bval, bvec)
  64 
  65         gtab.b0_threshold = self.inputs.b0_thres
  66         return gtab
  67 
  68     def _gen_filename(self, name, ext=None):
  69         fname, fext = op.splitext(op.basename(self.inputs.in_file))
  70         if fext == '.gz':
  71             fname, fext2 = op.splitext(fname)
  72             fext = fext2 + fext
  73 
  74         if not isdefined(self.inputs.out_prefix):
  75             out_prefix = op.abspath(fname)
  76         else:
  77             out_prefix = self.inputs.out_prefix
  78 
  79         if ext is None:
  80             ext = fext
  81 
  82         return out_prefix + '_' + name + ext
  83
  ```
  --- 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/nipype/interfaces/dipy/base.py b/nipype/interfaces/dipy/base.py
  --- a/nipype/interfaces/dipy/base.py
  +++ b/nipype/interfaces/dipy/base.py
  @@ -36,7 +36,7 @@
       """
       def __init__(self, **inputs):
           if no_dipy():
  -            IFLOGGER.error('dipy was not found')
  +            IFLOGGER.warn('dipy was not found')
               # raise ImportError('dipy was not found')
           super(DipyBaseInterface, self).__init__(**inputs)
  
verification_info: {"golden_diff": "diff --git a/nipype/interfaces/dipy/base.py b/nipype/interfaces/dipy/base.py\n--- a/nipype/interfaces/dipy/base.py\n+++ b/nipype/interfaces/dipy/base.py\n@@ -36,7 +36,7 @@\n     \"\"\"\n     def __init__(self, **inputs):\n         if no_dipy():\n-            IFLOGGER.error('dipy was not found')\n+            IFLOGGER.warn('dipy was not found')\n             # raise ImportError('dipy was not found')\n         super(DipyBaseInterface, self).__init__(**inputs)\n", "issue": "[BUG] Build documentation fails if dipy is not installed\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\"\"\" Base interfaces for dipy \"\"\"\nimport os.path as op\nimport numpy as np\nfrom nipype.interfaces.base import (traits, File, isdefined,\n                                    BaseInterface, BaseInterfaceInputSpec)\nfrom ... import logging\n\nIFLOGGER = logging.getLogger('interface')\n\nHAVE_DIPY = True\ntry:\n    import dipy\nexcept ImportError:\n    HAVE_DIPY = False\n\n\ndef no_dipy():\n    \"\"\" Check if dipy is available \"\"\"\n    global HAVE_DIPY\n    return not HAVE_DIPY\n\n\ndef dipy_version():\n    \"\"\" Check dipy version \"\"\"\n    if no_dipy():\n        return None\n\n    return dipy.__version__\n\n\nclass DipyBaseInterface(BaseInterface):\n\n    \"\"\"\n    A base interface for py:mod:`dipy` computations\n    \"\"\"\n    def __init__(self, **inputs):\n        if no_dipy():\n            IFLOGGER.error('dipy was not found')\n            # raise ImportError('dipy was not found')\n        super(DipyBaseInterface, self).__init__(**inputs)\n\n\nclass DipyBaseInterfaceInputSpec(BaseInterfaceInputSpec):\n    in_file = File(exists=True, mandatory=True, desc=('input diffusion data'))\n    in_bval = File(exists=True, mandatory=True, desc=('input b-values table'))\n    in_bvec = File(exists=True, mandatory=True, desc=('input b-vectors table'))\n    b0_thres = traits.Int(700, usedefault=True, desc=('b0 threshold'))\n    out_prefix = traits.Str(desc=('output prefix for file names'))\n\n\nclass DipyDiffusionInterface(DipyBaseInterface):\n\n    \"\"\"\n    A base interface for py:mod:`dipy` computations\n    \"\"\"\n    input_spec = DipyBaseInterfaceInputSpec\n\n    def _get_gradient_table(self):\n        bval = np.loadtxt(self.inputs.in_bval)\n        bvec = np.loadtxt(self.inputs.in_bvec).T\n        from dipy.core.gradients import gradient_table\n        gtab = gradient_table(bval, bvec)\n\n        gtab.b0_threshold = self.inputs.b0_thres\n        return gtab\n\n    def _gen_filename(self, name, ext=None):\n        fname, fext = op.splitext(op.basename(self.inputs.in_file))\n        if fext == '.gz':\n            fname, fext2 = op.splitext(fname)\n            fext = fext2 + fext\n\n        if not isdefined(self.inputs.out_prefix):\n            out_prefix = op.abspath(fname)\n        else:\n            out_prefix = self.inputs.out_prefix\n\n        if ext is None:\n            ext = fext\n\n        return out_prefix + '_' + name + ext\n", "path": "nipype/interfaces/dipy/base.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\"\"\" Base interfaces for dipy \"\"\"\nimport os.path as op\nimport numpy as np\nfrom nipype.interfaces.base import (traits, File, isdefined,\n                                    BaseInterface, BaseInterfaceInputSpec)\nfrom ... import logging\n\nIFLOGGER = logging.getLogger('interface')\n\nHAVE_DIPY = True\ntry:\n    import dipy\nexcept ImportError:\n    HAVE_DIPY = False\n\n\ndef no_dipy():\n    \"\"\" Check if dipy is available \"\"\"\n    global HAVE_DIPY\n    return not HAVE_DIPY\n\n\ndef dipy_version():\n    \"\"\" Check dipy version \"\"\"\n    if no_dipy():\n        return None\n\n    return dipy.__version__\n\n\nclass DipyBaseInterface(BaseInterface):\n\n    \"\"\"\n    A base interface for py:mod:`dipy` computations\n    \"\"\"\n    def __init__(self, **inputs):\n        if no_dipy():\n            IFLOGGER.warn('dipy was not found')\n            # raise ImportError('dipy was not found')\n        super(DipyBaseInterface, self).__init__(**inputs)\n\n\nclass DipyBaseInterfaceInputSpec(BaseInterfaceInputSpec):\n    in_file = File(exists=True, mandatory=True, desc=('input diffusion data'))\n    in_bval = File(exists=True, mandatory=True, desc=('input b-values table'))\n    in_bvec = File(exists=True, mandatory=True, desc=('input b-vectors table'))\n    b0_thres = traits.Int(700, usedefault=True, desc=('b0 threshold'))\n    out_prefix = traits.Str(desc=('output prefix for file names'))\n\n\nclass DipyDiffusionInterface(DipyBaseInterface):\n\n    \"\"\"\n    A base interface for py:mod:`dipy` computations\n    \"\"\"\n    input_spec = DipyBaseInterfaceInputSpec\n\n    def _get_gradient_table(self):\n        bval = np.loadtxt(self.inputs.in_bval)\n        bvec = np.loadtxt(self.inputs.in_bvec).T\n        from dipy.core.gradients import gradient_table\n        gtab = gradient_table(bval, bvec)\n\n        gtab.b0_threshold = self.inputs.b0_thres\n        return gtab\n\n    def _gen_filename(self, name, ext=None):\n        fname, fext = op.splitext(op.basename(self.inputs.in_file))\n        if fext == '.gz':\n            fname, fext2 = op.splitext(fname)\n            fext = fext2 + fext\n\n        if not isdefined(self.inputs.out_prefix):\n            out_prefix = op.abspath(fname)\n        else:\n            out_prefix = self.inputs.out_prefix\n\n        if ext is None:\n            ext = fext\n\n        return out_prefix + '_' + name + ext\n", "path": "nipype/interfaces/dipy/base.py"}]}