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.
| 61 | |
| 62 | |
| 63 | class _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 | |
| 82 | class _AnnotationsExtrasList(UserList): |
no outgoing calls