@@ -165,19 +165,22 @@ def map_renderpass_binding(type, index: int | None) -> str:
165165 Map the PB encoded render pass attachment type to a description.
166166 '''
167167 if type == timeline_pb2 .RenderpassAttachmentType .undefined :
168- assert (( index is None ) or (index == 0 ) )
168+ assert (index is None ) or (index == 0 )
169169 return "U"
170- elif type == timeline_pb2 .RenderpassAttachmentType .color :
171- assert (index is not None )
170+
171+ if type == timeline_pb2 .RenderpassAttachmentType .color :
172+ assert index is not None
172173 return f"C{ index } "
173- elif type == timeline_pb2 .RenderpassAttachmentType .depth :
174- assert ((index is None ) or (index == 0 ))
174+
175+ if type == timeline_pb2 .RenderpassAttachmentType .depth :
176+ assert (index is None ) or (index == 0 )
175177 return "D"
176- elif type == timeline_pb2 .RenderpassAttachmentType .stencil :
177- assert ((index is None ) or (index == 0 ))
178+
179+ if type == timeline_pb2 .RenderpassAttachmentType .stencil :
180+ assert (index is None ) or (index == 0 )
178181 return "S"
179- else :
180- assert False
182+
183+ assert False
181184
182185
183186def map_image_transfer_type (type ) -> str :
@@ -186,16 +189,20 @@ def map_image_transfer_type(type) -> str:
186189 '''
187190 if type == timeline_pb2 .ImageTransferType .unknown_image_transfer :
188191 return "Unknown"
189- elif type == timeline_pb2 .ImageTransferType .clear_image :
192+
193+ if type == timeline_pb2 .ImageTransferType .clear_image :
190194 return "Clear image"
191- elif type == timeline_pb2 .ImageTransferType .copy_image :
195+
196+ if type == timeline_pb2 .ImageTransferType .copy_image :
192197 return "Copy image"
193- elif type == timeline_pb2 .ImageTransferType .copy_buffer_to_image :
198+
199+ if type == timeline_pb2 .ImageTransferType .copy_buffer_to_image :
194200 return "Copy buffer to image"
195- elif type == timeline_pb2 .ImageTransferType .copy_image_to_buffer :
201+
202+ if type == timeline_pb2 .ImageTransferType .copy_image_to_buffer :
196203 return "Copy image to buffer"
197- else :
198- assert False
204+
205+ assert False
199206
200207
201208def map_buffer_transfer_type (type ) -> str :
@@ -204,12 +211,14 @@ def map_buffer_transfer_type(type) -> str:
204211 '''
205212 if type == timeline_pb2 .BufferTransferType .unknown_buffer_transfer :
206213 return "Unknown"
207- elif type == timeline_pb2 .BufferTransferType .fill_buffer :
214+
215+ if type == timeline_pb2 .BufferTransferType .fill_buffer :
208216 return "Fill buffer"
209- elif type == timeline_pb2 .BufferTransferType .copy_buffer :
217+
218+ if type == timeline_pb2 .BufferTransferType .copy_buffer :
210219 return "Copy buffer"
211- else :
212- assert False
220+
221+ assert False
213222
214223
215224def map_as_build_type (type ) -> str :
@@ -218,29 +227,35 @@ def map_as_build_type(type) -> str:
218227 '''
219228 if type == timeline_pb2 .AccelerationStructureBuildType .unknown_as_build :
220229 return "Unknown"
221- elif type == timeline_pb2 .AccelerationStructureTransferType .fast_build :
230+
231+ if type == timeline_pb2 .AccelerationStructureTransferType .fast_build :
222232 return "Fast build"
223- elif type == timeline_pb2 .AccelerationStructureTransferType .fast_trace :
233+
234+ if type == timeline_pb2 .AccelerationStructureTransferType .fast_trace :
224235 return "Fast trace"
225- else :
226- assert False
236+
237+ assert False
227238
228239
229240def map_as_transfer_type (type ) -> str :
230241 '''
231242 Map the PB encoded acceleration structure transfer to a description.
232243 '''
233244 base_type = timeline_pb2 .AccelerationStructureTransferType
245+
234246 if type == base_type .unknown_as_transfer :
235247 return "Unknown"
236- elif type == base_type .struct_to_struct :
248+
249+ if type == base_type .struct_to_struct :
237250 return "Copy acceleration structure"
238- elif type == base_type .struct_to_mem :
251+
252+ if type == base_type .struct_to_mem :
239253 return "Copy acceleration structure to mem"
240- elif type == base_type .mem_to_struct :
254+
255+ if type == base_type .mem_to_struct :
241256 return "Copy mem to acceleration structure"
242- else :
243- assert False
257+
258+ assert False
244259
245260
246261def map_debug_label (labels : list [str ] | None ) -> list [str ]:
@@ -249,7 +264,8 @@ def map_debug_label(labels: list[str] | None) -> list[str]:
249264 '''
250265 if labels is None :
251266 return []
252- # need to convert it to a list from a RepeatedScalarContainer
267+
268+ # Need to convert it to a list from a RepeatedScalarContainer
253269 return [str (label ) for label in labels ]
254270
255271
@@ -292,7 +308,7 @@ def __init__(self, file_path: str, verbose: bool = False):
292308 file_path: File to write on the filesystem
293309 verbose: Should this use verbose logging?
294310 '''
295- self .devices : dict [int , GPUDeviceState ] = dict ()
311+ self .devices : dict [int , GPUDeviceState ] = {}
296312 self .last_submit : SubmitMetadataType | None = None
297313 self .last_render_pass : RenderpassMetadataType | None = None
298314 # pylint: disable=consider-using-with
0 commit comments