MCPcopy
hub / github.com/mne-tools/mne-python / _check_subject

Function _check_subject

mne/utils/check.py:307–328  ·  view source on GitHub ↗

Get subject name from class.

(
    first,
    second,
    *,
    raise_error=True,
    first_kind="class subject attribute",
    second_kind="input subject",
)

Source from the content-addressed store, hash-verified

305
306
307def _check_subject(
308 first,
309 second,
310 *,
311 raise_error=True,
312 first_kind="class subject attribute",
313 second_kind="input subject",
314):
315 """Get subject name from class."""
316 if second is not None:
317 _validate_type(second, "str", "subject input")
318 if first is not None and first != second:
319 raise ValueError(
320 f"{first_kind} ({repr(first)}) did not match {second_kind} ({second})"
321 )
322 return second
323 elif first is not None:
324 _validate_type(first, "str", f"Either {second_kind} subject or {first_kind}")
325 return first
326 elif raise_error is True:
327 raise ValueError(f"Neither {second_kind} subject nor {first_kind} was a string")
328 return None
329
330
331def _check_preload(inst, msg):

Callers 15

__init__Method · 0.85
__init__Method · 0.85
smoothMethod · 0.85
morphMethod · 0.85
center_of_massMethod · 0.85
_load_surfaceMethod · 0.85
labels_to_stcFunction · 0.85
__init__Method · 0.85
center_of_massMethod · 0.85
_check_stc_srcFunction · 0.85
stc_near_sensorsFunction · 0.85

Calls 1

_validate_typeFunction · 0.85

Tested by

no test coverage detected