@@ -85,9 +85,7 @@ def validate_baseline(self, tree: GlobalDeviceTree) -> None:
8585
8686 # Baseline must contain resources
8787 if not tree .hardware :
88- raise ValidationError (
89- "Baseline device tree must contain hardware resources section."
90- )
88+ raise ValidationError ("Baseline device tree must contain hardware resources section." )
9189
9290 # Validate resources structure
9391 if not tree .hardware .cpus :
@@ -124,27 +122,26 @@ def write_baseline(self, tree: GlobalDeviceTree) -> None:
124122 try :
125123 dtb_data = self .extractor .generate_global_dtb (tree )
126124 except Exception as e :
127- raise KernelInterfaceError (
128- f"Failed to generate baseline device tree blob: { e } "
129- ) from e
125+ raise KernelInterfaceError (f"Failed to generate baseline device tree blob: { e } " ) from e
130126
131127 # The kernfs write operation is handled atomically by the kernel
132128 try :
133- with open (self .baseline_path , 'wb' ) as f :
129+ with open (self .baseline_path , "wb" ) as f :
134130 f .write (dtb_data )
135131 f .flush ()
136132 os .fsync (f .fileno ())
137133
138134 if not self .baseline_path .exists ():
139135 raise KernelInterfaceError (
140- f"Baseline DTB write completed but file does not exist at { self .baseline_path } . "
141- f"Kernel may have rejected the write operation."
136+ f"Baseline DTB write completed but file does not exist at "
137+ f"{ self .baseline_path } . "
138+ "Kernel may have rejected the write operation."
142139 )
143140 file_size = self .baseline_path .stat ().st_size
144141 if file_size == 0 :
145142 raise KernelInterfaceError (
146- f "Baseline DTB written but file is empty. "
147- f "Kernel may have rejected the DTB format."
143+ "Baseline DTB written but file is empty. "
144+ "Kernel may have rejected the DTB format."
148145 )
149146
150147 except OSError as e :
@@ -170,13 +167,12 @@ def read_baseline(self) -> GlobalDeviceTree:
170167 "Initialize it first with 'kerf init'."
171168 )
172169
173- with open (self .baseline_path , 'rb' ) as f :
170+ with open (self .baseline_path , "rb" ) as f :
174171 dtb_data = f .read ()
175172
176173 if not dtb_data :
177174 raise KernelInterfaceError (
178- f"Root device tree is empty. "
179- "Initialize it first with 'kerf init'."
175+ "Root device tree is empty. Initialize it first with 'kerf init'."
180176 )
181177
182178 tree = self .parser .parse_dtb_from_bytes (dtb_data )
@@ -188,7 +184,4 @@ def read_baseline(self) -> GlobalDeviceTree:
188184 f"Failed to read root device tree from { self .baseline_path } : { e } "
189185 ) from e
190186 except ParseError as e :
191- raise ParseError (
192- f"Failed to parse root device tree: { e } "
193- ) from e
194-
187+ raise ParseError (f"Failed to parse root device tree: { e } " ) from e
0 commit comments