2525)
2626from ._logging import setup_logger
2727from ._pathlib import CloudPath , PathT , as_path , cloudpathlib_is_available
28- from ._schema import BIDSSchema
28+ from ._schema import SchemaAdapter
2929
3030_BIDS_SUBJECT_DIR_PATTERN = re .compile (r"sub-[a-zA-Z0-9]+" )
3131
9191
9292
9393def get_arrow_schema (
94- schema : BIDSSchema | pa .Schema | None = None ,
94+ schema : SchemaAdapter | pa .Schema | None = None ,
9595) -> pa .Schema :
9696 """Get Arrow schema of the BIDS dataset index.
9797
9898 Args:
99- schema: A `BIDSSchema `, a `pa.Schema`, or None to use the module-level
99+ schema: A `SchemaAdapter `, a `pa.Schema`, or None to use the module-level
100100 default BIDS schema.
101101 """
102- bids_schema = BIDSSchema . prepare (schema )
102+ bids_schema = SchemaAdapter . load (schema )
103103 entity_schema = bids_schema .arrow_schema
104104 index_fields = {
105105 name : pa .field (name , cfg ["dtype" ], metadata = cfg ["metadata" ])
@@ -120,12 +120,12 @@ def get_arrow_schema(
120120
121121
122122def get_column_names (
123- schema : BIDSSchema | pa .Schema | None = None ,
123+ schema : SchemaAdapter | pa .Schema | None = None ,
124124) -> enum .StrEnum :
125125 """Get an enum of the BIDS index columns.
126126
127127 Args:
128- schema: A `BIDSSchema `, a `pa.Schema`, or None to use the module-level
128+ schema: A `SchemaAdapter `, a `pa.Schema`, or None to use the module-level
129129 default BIDS schema.
130130 """
131131 arrow_schema = get_arrow_schema (schema = schema )
@@ -210,7 +210,7 @@ def index_dataset(
210210 chunksize : int = 32 ,
211211 executor_cls : type [Executor ] = ProcessPoolExecutor ,
212212 show_progress : bool = False ,
213- schema : BIDSSchema | pa .Schema | Namespace | str | Path | None = None ,
213+ schema : SchemaAdapter | pa .Schema | Namespace | str | Path | None = None ,
214214) -> pa .Table :
215215 """Index a BIDS dataset.
216216
@@ -226,7 +226,7 @@ def index_dataset(
226226 `ProcessPoolExecutor` when `max_workers > 0`.
227227 executor_cls: Executor class to use for parallel indexing.
228228 show_progress: Show progress bar.
229- schema: A `BIDSSchema `, `pa.Schema`, `Namespace`, path/URL, or None to use
229+ schema: A `SchemaAdapter `, `pa.Schema`, `Namespace`, path/URL, or None to use
230230 the module-level default. Per-call schema overrides propagate to worker
231231 processes.
232232
@@ -235,7 +235,7 @@ def index_dataset(
235235 """
236236 root = as_path (root )
237237
238- bids_schema = BIDSSchema . prepare (schema )
238+ bids_schema = SchemaAdapter . load (schema )
239239 entity_arrow_schema = bids_schema .arrow_schema
240240 full_schema = get_arrow_schema (schema = bids_schema )
241241
@@ -278,7 +278,7 @@ def batch_index_dataset(
278278 max_workers : int | None = 0 ,
279279 executor_cls : type [Executor ] = ProcessPoolExecutor ,
280280 show_progress : bool = False ,
281- schema : BIDSSchema | pa .Schema | Namespace | str | Path | None = None ,
281+ schema : SchemaAdapter | pa .Schema | Namespace | str | Path | None = None ,
282282) -> Generator [pa .Table , None , None ]:
283283 """Index a batch of BIDS datasets.
284284
@@ -290,13 +290,13 @@ def batch_index_dataset(
290290 See `concurrent.futures.ProcessPoolExecutor` for details.
291291 executor_cls: Executor class to use for parallel indexing.
292292 show_progress: Show progress bar.
293- schema: A `BIDSSchema `, `pa.Schema`, `Namespace`, path/URL, or None to use
293+ schema: A `SchemaAdapter `, `pa.Schema`, `Namespace`, path/URL, or None to use
294294 the module-level default.
295295
296296 Yields:
297297 An Arrow table index for each BIDS dataset.
298298 """
299- bids_schema = BIDSSchema . prepare (schema )
299+ bids_schema = SchemaAdapter . load (schema )
300300 entity_arrow_schema = bids_schema .arrow_schema
301301 func = partial (_batch_index_func , schema = entity_arrow_schema )
302302
@@ -421,7 +421,7 @@ def _index_bids_subject_dir(
421421
422422 Args:
423423 path: BIDS subject directory.
424- schema: BIDS entity Arrow schema (i.e. ``BIDSSchema .arrow_schema``).
424+ schema: BIDS entity Arrow schema (i.e. ``SchemaAdapter .arrow_schema``).
425425 Pass-through to validation; the full index schema is derived from
426426 it. None uses the module-level default.
427427 dataset: Dataset identifier; computed if not given.
0 commit comments