We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
BIDSLayout.get_nearest_helper() does not anticipate absent 'type' entity
Happens with openfmri ds000002 due to contained derivatives:

```
  File "/home/mih/.local/lib/python2.7/site-packages/bids/grabbids/bids_layout.py", line 45, in get_metadata
    potentialJSONs = self.get_nearest_helper(path, '.json', **kwargs)
  File "/home/mih/.local/lib/python2.7/site-packages/bids/grabbids/bids_layout.py", line 37, in get_nearest_helper
    type = self.files[path].entities['type']
KeyError: 'type'
()
> /home/mih/.local/lib/python2.7/site-packages/bids/grabbids/bids_layout.py(37)get_nearest_helper()
-> type = self.files[path].entities['type']
(Pdb) self.files[path].entities
{u'subject': '01'}
(Pdb) path
u'/tmp/openfmri/ds000002/derivatives/mriqc/anatomical_sub-01.pdf'
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `bids/grabbids/bids_layout.py`
Content:
```
1 import os
2 import json
3 import collections
4 
5 from io import open
6 
7 from os.path import dirname
8 from os.path import abspath
9 from os.path import join as pathjoin
10 
11 from .bids_validator import BIDSValidator
12 from grabbit import Layout
13 
14 __all__ = ['BIDSLayout']
15 
16 
17 class BIDSLayout(Layout):
18 
19     def __init__(self, path, config=None, validate=False,
20                  index_associated=True, extensions=None, **kwargs):
21         self.validator = BIDSValidator(index_associated=index_associated)
22         self.validate = validate
23         if config is None:
24             root = dirname(abspath(__file__))
25             config = pathjoin(root, 'config', 'bids.json')
26 
27         # Use dictionary config to allow extension augmentations
28         if not isinstance(config, collections.Mapping):
29             with open(config) as fobj:
30                 config = json.load(fobj)
31         for ext in extensions or []:
32             with open(pathjoin(root, 'config', '%s.json' % ext)) as fobj:
33                 ext_config = json.load(fobj)
34                 config['entities'].extend(ext_config['entities'])
35 
36         super(BIDSLayout, self).__init__(path, config,
37                                          dynamic_getters=True, **kwargs)
38 
39     def _validate_file(self, f):
40         # If validate=True then checks files according to BIDS and
41         # returns False if file doesn't fit BIDS specification
42         if not self.validate:
43             return True
44         to_check = f.path
45         to_check = to_check.split(os.path.abspath(self.root), maxsplit=1)[1]
46 
47         sep = os.path.sep
48         if to_check[:len(sep)] != sep:
49             to_check = sep + to_check
50         else:
51             None
52 
53         return self.validator.is_bids(to_check)
54 
55     def _get_nearest_helper(self, path, extension, type=None, **kwargs):
56         """ Helper function for grabbit get_nearest """
57         path = abspath(path)
58 
59         if path not in self.files:
60             raise ValueError(
61                 "File '%s' does not match any specification in the current "
62                 "BIDS project." % path)
63 
64         if not type:
65             # Constrain the search to .json files with the same type as target
66             type = self.files[path].entities['type']
67 
68         tmp = self.get_nearest(path, extensions=extension, all_=True,
69                                type=type, ignore_strict_entities=['type'],
70                                **kwargs)
71 
72         if len(tmp):
73             return tmp
74         else:
75             return None
76 
77     def get_metadata(self, path, **kwargs):
78         ''' Returns metadata found in JSON sidecars for the specified file.
79         Args:
80             path (str): Path to the file to get metadata for.
81             kwargs (dict): Optional keyword arguments to pass onto
82                 get_nearest().
83         Notes:
84             A dictionary containing metadata extracted from all matching .json
85             files is returned. In cases where the same key is found in multiple
86             files, the values in files closer to the input filename will take
87             precedence, per the inheritance rules in the BIDS specification.
88         '''
89         potentialJSONs = self._get_nearest_helper(path, '.json', **kwargs)
90 
91         if not isinstance(potentialJSONs, list):
92             return potentialJSONs
93 
94         merged_param_dict = {}
95         for json_file_path in reversed(potentialJSONs):
96             if os.path.exists(json_file_path):
97                 param_dict = json.load(open(json_file_path, "r",
98                                             encoding='utf-8'))
99                 merged_param_dict.update(param_dict)
100 
101         return merged_param_dict
102 
103     def get_bvec(self, path, **kwargs):
104         tmp = self._get_nearest_helper(path, 'bvec', type='dwi', **kwargs)[0]
105         if isinstance(tmp, list):
106             return tmp[0]
107         else:
108             return tmp
109 
110     def get_bval(self, path, **kwargs):
111         tmp = self._get_nearest_helper(path, 'bval', type='dwi', **kwargs)[0]
112         if isinstance(tmp, list):
113             return tmp[0]
114         else:
115             return tmp
116 
117     def get_events(self, path, **kwargs):
118         tmp = self._get_nearest_helper(path, '.tsv', type='events', **kwargs)
119         if isinstance(tmp, list):
120             return tmp[0]
121         else:
122             return tmp
123 
124     def get_fieldmap(self, path, return_list=False):
125         fieldmaps = self._get_fieldmaps(path)
126 
127         if return_list:
128             return fieldmaps
129         else:
130             if len(fieldmaps) == 1:
131                 return fieldmaps[0]
132             elif len(fieldmaps) > 1:
133                 raise ValueError("More than one fieldmap found, but the "
134                                  "'return_list' argument was set to False. "
135                                  "Either ensure that there is only one "
136                                  "fieldmap for this image, or set the "
137                                  "'return_list' argument to True and handle "
138                                  "the result as a list.")
139             else:  # len(fieldmaps) == 0
140                 return None
141 
142     def _get_fieldmaps(self, path):
143         sub = os.path.split(path)[1].split("_")[0].split("sub-")[1]
144         fieldmap_set = []
145         type_ = '(phase1|phasediff|epi|fieldmap)'
146         for file in self.get(subject=sub, type=type_,
147                              extensions=['nii.gz', 'nii']):
148             metadata = self.get_metadata(file.filename)
149             if metadata and "IntendedFor" in metadata.keys():
150                 if isinstance(metadata["IntendedFor"], list):
151                     intended_for = metadata["IntendedFor"]
152                 else:
153                     intended_for = [metadata["IntendedFor"]]
154                 if any([path.endswith(suffix) for suffix in intended_for]):
155                     cur_fieldmap = {}
156                     if file.type == "phasediff":
157                         cur_fieldmap = {"phasediff": file.filename,
158                                         "magnitude1": file.filename.replace(
159                                             "phasediff", "magnitude1"),
160                                         "type": "phasediff"}
161                         magnitude2 = file.filename.replace(
162                             "phasediff", "magnitude2")
163                         if os.path.isfile(magnitude2):
164                             cur_fieldmap['magnitude2'] = magnitude2
165                     elif file.type == "phase1":
166                         cur_fieldmap["phase1"] = file.filename
167                         cur_fieldmap["magnitude1"] = \
168                             file.filename.replace("phase1", "magnitude1")
169                         cur_fieldmap["phase2"] = \
170                             file.filename.replace("phase1", "phase2")
171                         cur_fieldmap["magnitude2"] = \
172                             file.filename.replace("phase1", "magnitude2")
173                         cur_fieldmap["type"] = "phase"
174                     elif file.type == "epi":
175                         cur_fieldmap["epi"] = file.filename
176                         cur_fieldmap["type"] = "epi"
177                     elif file.type == "fieldmap":
178                         cur_fieldmap["fieldmap"] = file.filename
179                         cur_fieldmap["magnitude"] = \
180                             file.filename.replace("fieldmap", "magnitude")
181                         cur_fieldmap["type"] = "fieldmap"
182                     fieldmap_set.append(cur_fieldmap)
183         return fieldmap_set
184
```
--- 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/bids/grabbids/bids_layout.py b/bids/grabbids/bids_layout.py
--- a/bids/grabbids/bids_layout.py
+++ b/bids/grabbids/bids_layout.py
@@ -62,7 +62,11 @@
                 "BIDS project." % path)
 
         if not type:
-            # Constrain the search to .json files with the same type as target
+            if 'type' not in self.files[path].entities:
+                raise ValueError(
+                    "File '%s' does not have a valid type definition, most "
+                    "likely because it is not a valid BIDS file." % path
+                )
             type = self.files[path].entities['type']
 
         tmp = self.get_nearest(path, extensions=extension, all_=True,

{"golden_diff": "diff --git a/bids/grabbids/bids_layout.py b/bids/grabbids/bids_layout.py\n--- a/bids/grabbids/bids_layout.py\n+++ b/bids/grabbids/bids_layout.py\n@@ -62,7 +62,11 @@\n                 \"BIDS project.\" % path)\n \n         if not type:\n-            # Constrain the search to .json files with the same type as target\n+            if 'type' not in self.files[path].entities:\n+                raise ValueError(\n+                    \"File '%s' does not have a valid type definition, most \"\n+                    \"likely because it is not a valid BIDS file.\" % path\n+                )\n             type = self.files[path].entities['type']\n \n         tmp = self.get_nearest(path, extensions=extension, all_=True,\n", "issue": "BIDSLayout.get_nearest_helper() does not anticipate absent 'type' entity\nHappens with openfmri ds000002 due to contained derivatives:\r\n\r\n```\r\n  File \"/home/mih/.local/lib/python2.7/site-packages/bids/grabbids/bids_layout.py\", line 45, in get_metadata\r\n    potentialJSONs = self.get_nearest_helper(path, '.json', **kwargs)\r\n  File \"/home/mih/.local/lib/python2.7/site-packages/bids/grabbids/bids_layout.py\", line 37, in get_nearest_helper\r\n    type = self.files[path].entities['type']\r\nKeyError: 'type'\r\n()\r\n> /home/mih/.local/lib/python2.7/site-packages/bids/grabbids/bids_layout.py(37)get_nearest_helper()\r\n-> type = self.files[path].entities['type']\r\n(Pdb) self.files[path].entities\r\n{u'subject': '01'}\r\n(Pdb) path\r\nu'/tmp/openfmri/ds000002/derivatives/mriqc/anatomical_sub-01.pdf'\r\n```\n", "before_files": [{"content": "import os\nimport json\nimport collections\n\nfrom io import open\n\nfrom os.path import dirname\nfrom os.path import abspath\nfrom os.path import join as pathjoin\n\nfrom .bids_validator import BIDSValidator\nfrom grabbit import Layout\n\n__all__ = ['BIDSLayout']\n\n\nclass BIDSLayout(Layout):\n\n    def __init__(self, path, config=None, validate=False,\n                 index_associated=True, extensions=None, **kwargs):\n        self.validator = BIDSValidator(index_associated=index_associated)\n        self.validate = validate\n        if config is None:\n            root = dirname(abspath(__file__))\n            config = pathjoin(root, 'config', 'bids.json')\n\n        # Use dictionary config to allow extension augmentations\n        if not isinstance(config, collections.Mapping):\n            with open(config) as fobj:\n                config = json.load(fobj)\n        for ext in extensions or []:\n            with open(pathjoin(root, 'config', '%s.json' % ext)) as fobj:\n                ext_config = json.load(fobj)\n                config['entities'].extend(ext_config['entities'])\n\n        super(BIDSLayout, self).__init__(path, config,\n                                         dynamic_getters=True, **kwargs)\n\n    def _validate_file(self, f):\n        # If validate=True then checks files according to BIDS and\n        # returns False if file doesn't fit BIDS specification\n        if not self.validate:\n            return True\n        to_check = f.path\n        to_check = to_check.split(os.path.abspath(self.root), maxsplit=1)[1]\n\n        sep = os.path.sep\n        if to_check[:len(sep)] != sep:\n            to_check = sep + to_check\n        else:\n            None\n\n        return self.validator.is_bids(to_check)\n\n    def _get_nearest_helper(self, path, extension, type=None, **kwargs):\n        \"\"\" Helper function for grabbit get_nearest \"\"\"\n        path = abspath(path)\n\n        if path not in self.files:\n            raise ValueError(\n                \"File '%s' does not match any specification in the current \"\n                \"BIDS project.\" % path)\n\n        if not type:\n            # Constrain the search to .json files with the same type as target\n            type = self.files[path].entities['type']\n\n        tmp = self.get_nearest(path, extensions=extension, all_=True,\n                               type=type, ignore_strict_entities=['type'],\n                               **kwargs)\n\n        if len(tmp):\n            return tmp\n        else:\n            return None\n\n    def get_metadata(self, path, **kwargs):\n        ''' Returns metadata found in JSON sidecars for the specified file.\n        Args:\n            path (str): Path to the file to get metadata for.\n            kwargs (dict): Optional keyword arguments to pass onto\n                get_nearest().\n        Notes:\n            A dictionary containing metadata extracted from all matching .json\n            files is returned. In cases where the same key is found in multiple\n            files, the values in files closer to the input filename will take\n            precedence, per the inheritance rules in the BIDS specification.\n        '''\n        potentialJSONs = self._get_nearest_helper(path, '.json', **kwargs)\n\n        if not isinstance(potentialJSONs, list):\n            return potentialJSONs\n\n        merged_param_dict = {}\n        for json_file_path in reversed(potentialJSONs):\n            if os.path.exists(json_file_path):\n                param_dict = json.load(open(json_file_path, \"r\",\n                                            encoding='utf-8'))\n                merged_param_dict.update(param_dict)\n\n        return merged_param_dict\n\n    def get_bvec(self, path, **kwargs):\n        tmp = self._get_nearest_helper(path, 'bvec', type='dwi', **kwargs)[0]\n        if isinstance(tmp, list):\n            return tmp[0]\n        else:\n            return tmp\n\n    def get_bval(self, path, **kwargs):\n        tmp = self._get_nearest_helper(path, 'bval', type='dwi', **kwargs)[0]\n        if isinstance(tmp, list):\n            return tmp[0]\n        else:\n            return tmp\n\n    def get_events(self, path, **kwargs):\n        tmp = self._get_nearest_helper(path, '.tsv', type='events', **kwargs)\n        if isinstance(tmp, list):\n            return tmp[0]\n        else:\n            return tmp\n\n    def get_fieldmap(self, path, return_list=False):\n        fieldmaps = self._get_fieldmaps(path)\n\n        if return_list:\n            return fieldmaps\n        else:\n            if len(fieldmaps) == 1:\n                return fieldmaps[0]\n            elif len(fieldmaps) > 1:\n                raise ValueError(\"More than one fieldmap found, but the \"\n                                 \"'return_list' argument was set to False. \"\n                                 \"Either ensure that there is only one \"\n                                 \"fieldmap for this image, or set the \"\n                                 \"'return_list' argument to True and handle \"\n                                 \"the result as a list.\")\n            else:  # len(fieldmaps) == 0\n                return None\n\n    def _get_fieldmaps(self, path):\n        sub = os.path.split(path)[1].split(\"_\")[0].split(\"sub-\")[1]\n        fieldmap_set = []\n        type_ = '(phase1|phasediff|epi|fieldmap)'\n        for file in self.get(subject=sub, type=type_,\n                             extensions=['nii.gz', 'nii']):\n            metadata = self.get_metadata(file.filename)\n            if metadata and \"IntendedFor\" in metadata.keys():\n                if isinstance(metadata[\"IntendedFor\"], list):\n                    intended_for = metadata[\"IntendedFor\"]\n                else:\n                    intended_for = [metadata[\"IntendedFor\"]]\n                if any([path.endswith(suffix) for suffix in intended_for]):\n                    cur_fieldmap = {}\n                    if file.type == \"phasediff\":\n                        cur_fieldmap = {\"phasediff\": file.filename,\n                                        \"magnitude1\": file.filename.replace(\n                                            \"phasediff\", \"magnitude1\"),\n                                        \"type\": \"phasediff\"}\n                        magnitude2 = file.filename.replace(\n                            \"phasediff\", \"magnitude2\")\n                        if os.path.isfile(magnitude2):\n                            cur_fieldmap['magnitude2'] = magnitude2\n                    elif file.type == \"phase1\":\n                        cur_fieldmap[\"phase1\"] = file.filename\n                        cur_fieldmap[\"magnitude1\"] = \\\n                            file.filename.replace(\"phase1\", \"magnitude1\")\n                        cur_fieldmap[\"phase2\"] = \\\n                            file.filename.replace(\"phase1\", \"phase2\")\n                        cur_fieldmap[\"magnitude2\"] = \\\n                            file.filename.replace(\"phase1\", \"magnitude2\")\n                        cur_fieldmap[\"type\"] = \"phase\"\n                    elif file.type == \"epi\":\n                        cur_fieldmap[\"epi\"] = file.filename\n                        cur_fieldmap[\"type\"] = \"epi\"\n                    elif file.type == \"fieldmap\":\n                        cur_fieldmap[\"fieldmap\"] = file.filename\n                        cur_fieldmap[\"magnitude\"] = \\\n                            file.filename.replace(\"fieldmap\", \"magnitude\")\n                        cur_fieldmap[\"type\"] = \"fieldmap\"\n                    fieldmap_set.append(cur_fieldmap)\n        return fieldmap_set\n", "path": "bids/grabbids/bids_layout.py"}], "after_files": [{"content": "import os\nimport json\nimport collections\n\nfrom io import open\n\nfrom os.path import dirname\nfrom os.path import abspath\nfrom os.path import join as pathjoin\n\nfrom .bids_validator import BIDSValidator\nfrom grabbit import Layout\n\n__all__ = ['BIDSLayout']\n\n\nclass BIDSLayout(Layout):\n\n    def __init__(self, path, config=None, validate=False,\n                 index_associated=True, extensions=None, **kwargs):\n        self.validator = BIDSValidator(index_associated=index_associated)\n        self.validate = validate\n        if config is None:\n            root = dirname(abspath(__file__))\n            config = pathjoin(root, 'config', 'bids.json')\n\n        # Use dictionary config to allow extension augmentations\n        if not isinstance(config, collections.Mapping):\n            with open(config) as fobj:\n                config = json.load(fobj)\n        for ext in extensions or []:\n            with open(pathjoin(root, 'config', '%s.json' % ext)) as fobj:\n                ext_config = json.load(fobj)\n                config['entities'].extend(ext_config['entities'])\n\n        super(BIDSLayout, self).__init__(path, config,\n                                         dynamic_getters=True, **kwargs)\n\n    def _validate_file(self, f):\n        # If validate=True then checks files according to BIDS and\n        # returns False if file doesn't fit BIDS specification\n        if not self.validate:\n            return True\n        to_check = f.path\n        to_check = to_check.split(os.path.abspath(self.root), maxsplit=1)[1]\n\n        sep = os.path.sep\n        if to_check[:len(sep)] != sep:\n            to_check = sep + to_check\n        else:\n            None\n\n        return self.validator.is_bids(to_check)\n\n    def _get_nearest_helper(self, path, extension, type=None, **kwargs):\n        \"\"\" Helper function for grabbit get_nearest \"\"\"\n        path = abspath(path)\n\n        if path not in self.files:\n            raise ValueError(\n                \"File '%s' does not match any specification in the current \"\n                \"BIDS project.\" % path)\n\n        if not type:\n            if 'type' not in self.files[path].entities:\n                raise ValueError(\n                    \"File '%s' does not have a valid type definition, most \"\n                    \"likely because it is not a valid BIDS file.\" % path\n                )\n            type = self.files[path].entities['type']\n\n        tmp = self.get_nearest(path, extensions=extension, all_=True,\n                               type=type, ignore_strict_entities=['type'],\n                               **kwargs)\n\n        if len(tmp):\n            return tmp\n        else:\n            return None\n\n    def get_metadata(self, path, **kwargs):\n        ''' Returns metadata found in JSON sidecars for the specified file.\n        Args:\n            path (str): Path to the file to get metadata for.\n            kwargs (dict): Optional keyword arguments to pass onto\n                get_nearest().\n        Notes:\n            A dictionary containing metadata extracted from all matching .json\n            files is returned. In cases where the same key is found in multiple\n            files, the values in files closer to the input filename will take\n            precedence, per the inheritance rules in the BIDS specification.\n        '''\n        potentialJSONs = self._get_nearest_helper(path, '.json', **kwargs)\n\n        if not isinstance(potentialJSONs, list):\n            return potentialJSONs\n\n        merged_param_dict = {}\n        for json_file_path in reversed(potentialJSONs):\n            if os.path.exists(json_file_path):\n                param_dict = json.load(open(json_file_path, \"r\",\n                                            encoding='utf-8'))\n                merged_param_dict.update(param_dict)\n\n        return merged_param_dict\n\n    def get_bvec(self, path, **kwargs):\n        tmp = self._get_nearest_helper(path, 'bvec', type='dwi', **kwargs)[0]\n        if isinstance(tmp, list):\n            return tmp[0]\n        else:\n            return tmp\n\n    def get_bval(self, path, **kwargs):\n        tmp = self._get_nearest_helper(path, 'bval', type='dwi', **kwargs)[0]\n        if isinstance(tmp, list):\n            return tmp[0]\n        else:\n            return tmp\n\n    def get_events(self, path, **kwargs):\n        tmp = self._get_nearest_helper(path, '.tsv', type='events', **kwargs)\n        if isinstance(tmp, list):\n            return tmp[0]\n        else:\n            return tmp\n\n    def get_fieldmap(self, path, return_list=False):\n        fieldmaps = self._get_fieldmaps(path)\n\n        if return_list:\n            return fieldmaps\n        else:\n            if len(fieldmaps) == 1:\n                return fieldmaps[0]\n            elif len(fieldmaps) > 1:\n                raise ValueError(\"More than one fieldmap found, but the \"\n                                 \"'return_list' argument was set to False. \"\n                                 \"Either ensure that there is only one \"\n                                 \"fieldmap for this image, or set the \"\n                                 \"'return_list' argument to True and handle \"\n                                 \"the result as a list.\")\n            else:  # len(fieldmaps) == 0\n                return None\n\n    def _get_fieldmaps(self, path):\n        sub = os.path.split(path)[1].split(\"_\")[0].split(\"sub-\")[1]\n        fieldmap_set = []\n        type_ = '(phase1|phasediff|epi|fieldmap)'\n        for file in self.get(subject=sub, type=type_,\n                             extensions=['nii.gz', 'nii']):\n            metadata = self.get_metadata(file.filename)\n            if metadata and \"IntendedFor\" in metadata.keys():\n                if isinstance(metadata[\"IntendedFor\"], list):\n                    intended_for = metadata[\"IntendedFor\"]\n                else:\n                    intended_for = [metadata[\"IntendedFor\"]]\n                if any([path.endswith(suffix) for suffix in intended_for]):\n                    cur_fieldmap = {}\n                    if file.type == \"phasediff\":\n                        cur_fieldmap = {\"phasediff\": file.filename,\n                                        \"magnitude1\": file.filename.replace(\n                                            \"phasediff\", \"magnitude1\"),\n                                        \"type\": \"phasediff\"}\n                        magnitude2 = file.filename.replace(\n                            \"phasediff\", \"magnitude2\")\n                        if os.path.isfile(magnitude2):\n                            cur_fieldmap['magnitude2'] = magnitude2\n                    elif file.type == \"phase1\":\n                        cur_fieldmap[\"phase1\"] = file.filename\n                        cur_fieldmap[\"magnitude1\"] = \\\n                            file.filename.replace(\"phase1\", \"magnitude1\")\n                        cur_fieldmap[\"phase2\"] = \\\n                            file.filename.replace(\"phase1\", \"phase2\")\n                        cur_fieldmap[\"magnitude2\"] = \\\n                            file.filename.replace(\"phase1\", \"magnitude2\")\n                        cur_fieldmap[\"type\"] = \"phase\"\n                    elif file.type == \"epi\":\n                        cur_fieldmap[\"epi\"] = file.filename\n                        cur_fieldmap[\"type\"] = \"epi\"\n                    elif file.type == \"fieldmap\":\n                        cur_fieldmap[\"fieldmap\"] = file.filename\n                        cur_fieldmap[\"magnitude\"] = \\\n                            file.filename.replace(\"fieldmap\", \"magnitude\")\n                        cur_fieldmap[\"type\"] = \"fieldmap\"\n                    fieldmap_set.append(cur_fieldmap)\n        return fieldmap_set\n", "path": "bids/grabbids/bids_layout.py"}]}