MCPcopy Index your code
hub / github.com/mne-tools/mne-python / _AnnotationsExtrasDict

Class _AnnotationsExtrasDict

mne/annotations.py:63–79  ·  view source on GitHub ↗

A dictionary for storing extra fields of annotations. The keys of the dictionary are strings, and the values can be strings, integers, floats, or None.

Source from the content-addressed store, hash-verified

61
62
63class _AnnotationsExtrasDict(UserDict):
64 """A dictionary for storing extra fields of annotations.
65
66 The keys of the dictionary are strings, and the values can be
67 strings, integers, floats, or None.
68 """
69
70 def __setitem__(self, key: str, value: str | int | float | None) -> None:
71 _validate_type(key, str, "key")
72 if key in ("onset", "duration", "description", "ch_names", "hed_string"):
73 raise ValueError(f"Key '{key}' is reserved and cannot be used in extras.")
74 _validate_type(
75 value,
76 (str, int, float, None),
77 "value",
78 )
79 super().__setitem__(key, value)
80
81
82class _AnnotationsExtrasList(UserList):

Callers 2

test_extras_dict_raisesFunction · 0.90
_validate_valueMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_extras_dict_raisesFunction · 0.72