(
self,
onset,
duration,
description,
orig_time=None,
ch_names=None,
*,
extras=None,
)
| 384 | """ # noqa: E501 |
| 385 | |
| 386 | def __init__( |
| 387 | self, |
| 388 | onset, |
| 389 | duration, |
| 390 | description, |
| 391 | orig_time=None, |
| 392 | ch_names=None, |
| 393 | *, |
| 394 | extras=None, |
| 395 | ): |
| 396 | self._orig_time = _handle_meas_date(orig_time) |
| 397 | if isinstance(orig_time, str) and self._orig_time is None: |
| 398 | try: # only warn if `orig_time` is not the default '1970-01-01 00:00:00' |
| 399 | if _handle_meas_date(0) == datetime.strptime( |
| 400 | orig_time, "%Y-%m-%d %H:%M:%S" |
| 401 | ).replace(tzinfo=timezone.utc): |
| 402 | pass |
| 403 | except ValueError: # error if incorrect datetime format AND not the default |
| 404 | warn( |
| 405 | "The format of the `orig_time` string is not recognised. It " |
| 406 | "must conform to the ISO8601 format with at most microsecond " |
| 407 | "precision and where the delimiter between date and time is " |
| 408 | f"' '. Got: {orig_time}. Defaulting `orig_time` to None.", |
| 409 | RuntimeWarning, |
| 410 | ) |
| 411 | self.onset, self.duration, self.description, self.ch_names, self._extras = ( |
| 412 | _check_o_d_s_c_e(onset, duration, description, ch_names, extras) |
| 413 | ) |
| 414 | self._sort() # ensure we're sorted |
| 415 | |
| 416 | @property |
| 417 | def orig_time(self): |
no test coverage detected