@@ -32,7 +32,7 @@ def __init__(self, record_name, mode="r"):
3232 """
3333 self .record_name = record_name
3434 # Only append .wfdb if it's not already there
35- if record_name .endswith (' .wfdb' ):
35+ if record_name .endswith (" .wfdb" ):
3636 self .archive_path = record_name
3737 else :
3838 self .archive_path = f"{ record_name } .wfdb"
@@ -45,24 +45,19 @@ def __init__(self, record_name, mode="r"):
4545 f"Archive not found: { self .archive_path } "
4646 )
4747 if not zipfile .is_zipfile (self .archive_path ):
48- raise ValueError (
49- f"Invalid WFDB archive: { self .archive_path } "
50- )
51- self .zipfile = zipfile .ZipFile (
52- self .archive_path , mode = "r"
53- )
48+ raise ValueError (f"Invalid WFDB archive: { self .archive_path } " )
49+ self .zipfile = zipfile .ZipFile (self .archive_path , mode = "r" )
5450
5551 elif mode == "w" :
5652 # Create archive file if needed
5753 if not os .path .exists (self .archive_path ):
5854 # Create the directory if it doesn't exist
59- os .makedirs (os . path . dirname ( os . path . abspath ( self . archive_path )), exist_ok = True )
60- WFDBArchive . make_archive_file (
61- [], self . archive_path
55+ os .makedirs (
56+ os . path . dirname ( os . path . abspath ( self . archive_path )),
57+ exist_ok = True ,
6258 )
63- self .zipfile = zipfile .ZipFile (
64- self .archive_path , mode = "a"
65- )
59+ WFDBArchive .make_archive_file ([], self .archive_path )
60+ self .zipfile = zipfile .ZipFile (self .archive_path , mode = "a" )
6661
6762 def __enter__ (self ):
6863 return self
0 commit comments