prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Globbing should be advertised in doc/examples.
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `examples/00_tutorials/plot_nilearn_101.py`
  Content:
  ```
  1 """
  2 Basic nilearn example: manipulating and looking at data
  3 =======================================================
  4 
  5 A simple example showing how to load an existing Nifti file and use
  6 basic nilearn functionalities.
  7 """
  8 
  9 # Let us use a Nifti file that is shipped with nilearn
  10 from nilearn.datasets import MNI152_FILE_PATH
  11 
  12 # Note that the variable MNI152_FILE_PATH is just a path to a Nifti file
  13 print(f"Path to MNI152 template: {MNI152_FILE_PATH!r}")
  14 
  15 # %%
  16 # A first step: looking at our data
  17 # ----------------------------------
  18 #
  19 # Let's quickly plot this file:
  20 from nilearn import plotting
  21 
  22 plotting.plot_img(MNI152_FILE_PATH)
  23 
  24 # %%
  25 # This is not a very pretty plot. We just used the simplest possible
  26 # code. There is a whole :ref:`section of the documentation <plotting>`
  27 # on making prettier code.
  28 #
  29 # **Exercise**: Try plotting one of your own files. In the above,
  30 # MNI152_FILE_PATH is nothing more than a string with a path pointing to
  31 # a nifti image. You can replace it with a string pointing to a file on
  32 # your disk. Note that it should be a 3D volume, and not a 4D volume.
  33 
  34 # %%
  35 # Simple image manipulation: smoothing
  36 # ------------------------------------
  37 #
  38 # Let's use an image-smoothing function from nilearn:
  39 # :func:`nilearn.image.smooth_img`
  40 #
  41 # Functions containing 'img' can take either a filename or an image as input.
  42 #
  43 # Here we give as inputs the image filename and the smoothing value in mm
  44 from nilearn import image
  45 
  46 smooth_anat_img = image.smooth_img(MNI152_FILE_PATH, fwhm=3)
  47 
  48 # While we are giving a file name as input, the function returns
  49 # an in-memory object:
  50 smooth_anat_img
  51 
  52 # %%
  53 # This is an in-memory object. We can pass it to nilearn function, for
  54 # instance to look at it
  55 plotting.plot_img(smooth_anat_img)
  56 
  57 # %%
  58 # We could also pass it to the smoothing function
  59 more_smooth_anat_img = image.smooth_img(smooth_anat_img, fwhm=3)
  60 plotting.plot_img(more_smooth_anat_img)
  61 
  62 # %%
  63 # Saving results to a file
  64 # -------------------------
  65 #
  66 # We can save any in-memory object as follows:
  67 from pathlib import Path
  68 
  69 output_dir = Path.cwd() / "results" / "plot_nilearn_101"
  70 output_dir.mkdir(exist_ok=True, parents=True)
  71 print(f"Output will be saved to: {output_dir}")
  72 more_smooth_anat_img.to_filename(output_dir / "more_smooth_anat_img.nii.gz")
  73 
  74 # %%
  75 # Finally, calling plotting.show() is necessary to display the figure
  76 # when running as a script outside IPython
  77 plotting.show()
  78 
  79 # %%
  80 # |
  81 #
  82 # ______
  83 #
  84 # To recap, all the nilearn tools can take data as filenames or in-memory
  85 # objects, and return brain volumes as in-memory objects. These can be
  86 # passed on to other nilearn tools, or saved to disk.
  87 
  88 # sphinx_gallery_dummy_images=1
  89
  ```
  --- 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/examples/00_tutorials/plot_nilearn_101.py b/examples/00_tutorials/plot_nilearn_101.py
  --- a/examples/00_tutorials/plot_nilearn_101.py
  +++ b/examples/00_tutorials/plot_nilearn_101.py
  @@ -59,17 +59,49 @@
   more_smooth_anat_img = image.smooth_img(smooth_anat_img, fwhm=3)
   plotting.plot_img(more_smooth_anat_img)
   
  +
  +# %%
  +# Globbing over multiple 3D volumes
  +# ---------------------------------
  +# Nilearn also supports reading multiple volumes at once,
  +# using glob-style patterns.
  +# For instance, we can smooth volumes from many subjects
  +# at once and get a 4D image as output.
  +
  +# %%
  +# First let's fetch Haxby dataset for subject 1 and 2
  +from nilearn import datasets
  +
  +haxby = datasets.fetch_haxby(subjects=[1, 2])
  +
  +# %%
  +# Now we can find the anatomical images from both
  +# subjects using the `*` wildcard
  +from pathlib import Path
  +
  +anats_all_subjects = (
  +    Path(datasets.get_data_dirs()[0]) / "haxby2001" / "subj*" / "anat*"
  +)
  +
  +# %%
  +# Now we can smooth all the anatomical images at once
  +anats_all_subjects_smooth = image.smooth_img(anats_all_subjects, fwhm=5)
  +
  +# %%
  +# This is a 4D image containing one volume per subject
  +print(anats_all_subjects_smooth.shape)
  +
   # %%
   # Saving results to a file
   # -------------------------
   #
   # We can save any in-memory object as follows:
  -from pathlib import Path
  -
   output_dir = Path.cwd() / "results" / "plot_nilearn_101"
   output_dir.mkdir(exist_ok=True, parents=True)
   print(f"Output will be saved to: {output_dir}")
  -more_smooth_anat_img.to_filename(output_dir / "more_smooth_anat_img.nii.gz")
  +anats_all_subjects_smooth.to_filename(
  +    output_dir / "anats_all_subjects_smooth.nii.gz"
  +)
   
   # %%
   # Finally, calling plotting.show() is necessary to display the figure
  @@ -81,8 +113,9 @@
   #
   # ______
   #
  -# To recap, all the nilearn tools can take data as filenames or in-memory
  -# objects, and return brain volumes as in-memory objects. These can be
  +# To recap, all the nilearn tools can take data as filenames or
  +# glob-style patterns or in-memory objects, and return brain
  +# volumes as in-memory objects. These can be
   # passed on to other nilearn tools, or saved to disk.
   
   # sphinx_gallery_dummy_images=1
  
verification_info: {"golden_diff": "diff --git a/examples/00_tutorials/plot_nilearn_101.py b/examples/00_tutorials/plot_nilearn_101.py\n--- a/examples/00_tutorials/plot_nilearn_101.py\n+++ b/examples/00_tutorials/plot_nilearn_101.py\n@@ -59,17 +59,49 @@\n more_smooth_anat_img = image.smooth_img(smooth_anat_img, fwhm=3)\n plotting.plot_img(more_smooth_anat_img)\n \n+\n+# %%\n+# Globbing over multiple 3D volumes\n+# ---------------------------------\n+# Nilearn also supports reading multiple volumes at once,\n+# using glob-style patterns.\n+# For instance, we can smooth volumes from many subjects\n+# at once and get a 4D image as output.\n+\n+# %%\n+# First let's fetch Haxby dataset for subject 1 and 2\n+from nilearn import datasets\n+\n+haxby = datasets.fetch_haxby(subjects=[1, 2])\n+\n+# %%\n+# Now we can find the anatomical images from both\n+# subjects using the `*` wildcard\n+from pathlib import Path\n+\n+anats_all_subjects = (\n+    Path(datasets.get_data_dirs()[0]) / \"haxby2001\" / \"subj*\" / \"anat*\"\n+)\n+\n+# %%\n+# Now we can smooth all the anatomical images at once\n+anats_all_subjects_smooth = image.smooth_img(anats_all_subjects, fwhm=5)\n+\n+# %%\n+# This is a 4D image containing one volume per subject\n+print(anats_all_subjects_smooth.shape)\n+\n # %%\n # Saving results to a file\n # -------------------------\n #\n # We can save any in-memory object as follows:\n-from pathlib import Path\n-\n output_dir = Path.cwd() / \"results\" / \"plot_nilearn_101\"\n output_dir.mkdir(exist_ok=True, parents=True)\n print(f\"Output will be saved to: {output_dir}\")\n-more_smooth_anat_img.to_filename(output_dir / \"more_smooth_anat_img.nii.gz\")\n+anats_all_subjects_smooth.to_filename(\n+    output_dir / \"anats_all_subjects_smooth.nii.gz\"\n+)\n \n # %%\n # Finally, calling plotting.show() is necessary to display the figure\n@@ -81,8 +113,9 @@\n #\n # ______\n #\n-# To recap, all the nilearn tools can take data as filenames or in-memory\n-# objects, and return brain volumes as in-memory objects. These can be\n+# To recap, all the nilearn tools can take data as filenames or\n+# glob-style patterns or in-memory objects, and return brain\n+# volumes as in-memory objects. These can be\n # passed on to other nilearn tools, or saved to disk.\n \n # sphinx_gallery_dummy_images=1\n", "issue": "Globbing should be advertised in doc/examples.\n\n", "before_files": [{"content": "\"\"\"\nBasic nilearn example: manipulating and looking at data\n=======================================================\n\nA simple example showing how to load an existing Nifti file and use\nbasic nilearn functionalities.\n\"\"\"\n\n# Let us use a Nifti file that is shipped with nilearn\nfrom nilearn.datasets import MNI152_FILE_PATH\n\n# Note that the variable MNI152_FILE_PATH is just a path to a Nifti file\nprint(f\"Path to MNI152 template: {MNI152_FILE_PATH!r}\")\n\n# %%\n# A first step: looking at our data\n# ----------------------------------\n#\n# Let's quickly plot this file:\nfrom nilearn import plotting\n\nplotting.plot_img(MNI152_FILE_PATH)\n\n# %%\n# This is not a very pretty plot. We just used the simplest possible\n# code. There is a whole :ref:`section of the documentation <plotting>`\n# on making prettier code.\n#\n# **Exercise**: Try plotting one of your own files. In the above,\n# MNI152_FILE_PATH is nothing more than a string with a path pointing to\n# a nifti image. You can replace it with a string pointing to a file on\n# your disk. Note that it should be a 3D volume, and not a 4D volume.\n\n# %%\n# Simple image manipulation: smoothing\n# ------------------------------------\n#\n# Let's use an image-smoothing function from nilearn:\n# :func:`nilearn.image.smooth_img`\n#\n# Functions containing 'img' can take either a filename or an image as input.\n#\n# Here we give as inputs the image filename and the smoothing value in mm\nfrom nilearn import image\n\nsmooth_anat_img = image.smooth_img(MNI152_FILE_PATH, fwhm=3)\n\n# While we are giving a file name as input, the function returns\n# an in-memory object:\nsmooth_anat_img\n\n# %%\n# This is an in-memory object. We can pass it to nilearn function, for\n# instance to look at it\nplotting.plot_img(smooth_anat_img)\n\n# %%\n# We could also pass it to the smoothing function\nmore_smooth_anat_img = image.smooth_img(smooth_anat_img, fwhm=3)\nplotting.plot_img(more_smooth_anat_img)\n\n# %%\n# Saving results to a file\n# -------------------------\n#\n# We can save any in-memory object as follows:\nfrom pathlib import Path\n\noutput_dir = Path.cwd() / \"results\" / \"plot_nilearn_101\"\noutput_dir.mkdir(exist_ok=True, parents=True)\nprint(f\"Output will be saved to: {output_dir}\")\nmore_smooth_anat_img.to_filename(output_dir / \"more_smooth_anat_img.nii.gz\")\n\n# %%\n# Finally, calling plotting.show() is necessary to display the figure\n# when running as a script outside IPython\nplotting.show()\n\n# %%\n# |\n#\n# ______\n#\n# To recap, all the nilearn tools can take data as filenames or in-memory\n# objects, and return brain volumes as in-memory objects. These can be\n# passed on to other nilearn tools, or saved to disk.\n\n# sphinx_gallery_dummy_images=1\n", "path": "examples/00_tutorials/plot_nilearn_101.py"}], "after_files": [{"content": "\"\"\"\nBasic nilearn example: manipulating and looking at data\n=======================================================\n\nA simple example showing how to load an existing Nifti file and use\nbasic nilearn functionalities.\n\"\"\"\n\n# Let us use a Nifti file that is shipped with nilearn\nfrom nilearn.datasets import MNI152_FILE_PATH\n\n# Note that the variable MNI152_FILE_PATH is just a path to a Nifti file\nprint(f\"Path to MNI152 template: {MNI152_FILE_PATH!r}\")\n\n# %%\n# A first step: looking at our data\n# ----------------------------------\n#\n# Let's quickly plot this file:\nfrom nilearn import plotting\n\nplotting.plot_img(MNI152_FILE_PATH)\n\n# %%\n# This is not a very pretty plot. We just used the simplest possible\n# code. There is a whole :ref:`section of the documentation <plotting>`\n# on making prettier code.\n#\n# **Exercise**: Try plotting one of your own files. In the above,\n# MNI152_FILE_PATH is nothing more than a string with a path pointing to\n# a nifti image. You can replace it with a string pointing to a file on\n# your disk. Note that it should be a 3D volume, and not a 4D volume.\n\n# %%\n# Simple image manipulation: smoothing\n# ------------------------------------\n#\n# Let's use an image-smoothing function from nilearn:\n# :func:`nilearn.image.smooth_img`\n#\n# Functions containing 'img' can take either a filename or an image as input.\n#\n# Here we give as inputs the image filename and the smoothing value in mm\nfrom nilearn import image\n\nsmooth_anat_img = image.smooth_img(MNI152_FILE_PATH, fwhm=3)\n\n# While we are giving a file name as input, the function returns\n# an in-memory object:\nsmooth_anat_img\n\n# %%\n# This is an in-memory object. We can pass it to nilearn function, for\n# instance to look at it\nplotting.plot_img(smooth_anat_img)\n\n# %%\n# We could also pass it to the smoothing function\nmore_smooth_anat_img = image.smooth_img(smooth_anat_img, fwhm=3)\nplotting.plot_img(more_smooth_anat_img)\n\n\n# %%\n# Globbing over multiple 3D volumes\n# ---------------------------------\n# Nilearn also supports reading multiple volumes at once,\n# using glob-style patterns.\n# For instance, we can smooth volumes from many subjects\n# at once and get a 4D image as output.\n\n# %%\n# First let's fetch Haxby dataset for subject 1 and 2\nfrom nilearn import datasets\n\nhaxby = datasets.fetch_haxby(subjects=[1, 2])\n\n# %%\n# Now we can find the anatomical images from both\n# subjects using the `*` wildcard\nfrom pathlib import Path\n\nanats_all_subjects = (\n    Path(datasets.get_data_dirs()[0]) / \"haxby2001\" / \"subj*\" / \"anat*\"\n)\n\n# %%\n# Now we can smooth all the anatomical images at once\nanats_all_subjects_smooth = image.smooth_img(anats_all_subjects, fwhm=5)\n\n# %%\n# This is a 4D image containing one volume per subject\nprint(anats_all_subjects_smooth.shape)\n\n# %%\n# Saving results to a file\n# -------------------------\n#\n# We can save any in-memory object as follows:\noutput_dir = Path.cwd() / \"results\" / \"plot_nilearn_101\"\noutput_dir.mkdir(exist_ok=True, parents=True)\nprint(f\"Output will be saved to: {output_dir}\")\nanats_all_subjects_smooth.to_filename(\n    output_dir / \"anats_all_subjects_smooth.nii.gz\"\n)\n\n# %%\n# Finally, calling plotting.show() is necessary to display the figure\n# when running as a script outside IPython\nplotting.show()\n\n# %%\n# |\n#\n# ______\n#\n# To recap, all the nilearn tools can take data as filenames or\n# glob-style patterns or in-memory objects, and return brain\n# volumes as in-memory objects. These can be\n# passed on to other nilearn tools, or saved to disk.\n\n# sphinx_gallery_dummy_images=1\n", "path": "examples/00_tutorials/plot_nilearn_101.py"}]}