@@ -988,7 +988,9 @@ def writeSamples(self, data_list: Union[List[np.ndarray], np.ndarray], digital:
988988 if success < 0 :
989989 raise OSError (f'Unknown error while calling writeSamples: { success } ' )
990990
991- def writeAnnotation (self , onset_in_seconds : Union [int , float ], duration_in_seconds : Union [int , float ], description : str , str_format : str = 'utf_8' ) -> int :
991+ def writeAnnotation (self , onset_in_seconds : Union [int , float ],
992+ duration_in_seconds : Union [int , float ],
993+ description : str , str_format : str = 'utf_8' ) -> int :
992994 """
993995 Writes an annotation/event to the file
994996 """
@@ -1000,16 +1002,26 @@ def writeAnnotation(self, onset_in_seconds: Union[int, float], duration_in_secon
10001002
10011003 if str_format == 'utf_8' :
10021004 if duration_in_seconds >= 0 :
1003- return write_annotation_utf8 (self .handle , np .round (onset_in_seconds * 10000 ).astype (np .int64 ), np .round (duration_in_seconds * 10000 ).astype (int ), du (description ))
1005+ return write_annotation_utf8 (self .handle ,
1006+ np .round (onset_in_seconds * 10000 ).astype (np .int64 ),
1007+ np .round (duration_in_seconds * 10000 ).astype (int ),
1008+ du (description ))
10041009 else :
1005- return write_annotation_utf8 (self .handle , np .round (onset_in_seconds * 10000 ).astype (np .int64 ), - 1 , du (description ))
1010+ return write_annotation_utf8 (self .handle ,
1011+ np .round (onset_in_seconds * 10000 ).astype (np .int64 ),
1012+ - 1 , du (description ))
10061013 else :
10071014 if duration_in_seconds >= 0 :
10081015 # FIX: description must be bytes. string will fail in u function
1009- return write_annotation_latin1 (self .handle , np .round (onset_in_seconds * 10000 ).astype (np .int64 ), np .round (duration_in_seconds * 10000 ).astype (int ), u (description ).encode ('latin1' )) # type: ignore
1016+ return write_annotation_latin1 (self .handle ,
1017+ np .round (onset_in_seconds * 10000 ).astype (np .int64 ),
1018+ np .round (duration_in_seconds * 10000 ).astype (int ), description .encode ('latin1' )) # type: ignore
10101019 else :
10111020 # FIX: description must be bytes. string will fail in u function
1012- return write_annotation_latin1 (self .handle , np .round (onset_in_seconds * 10000 ).astype (np .int64 ), - 1 , u (description ).encode ('latin1' )) # type: ignore
1021+ return write_annotation_latin1 (self .handle ,
1022+ np .round (onset_in_seconds * 10000 ).astype (np .int64 ),
1023+ - 1 ,
1024+ description .encode ('latin1' )) # type: ignore
10131025
10141026 def close (self ) -> None :
10151027 """
0 commit comments