@@ -175,16 +175,14 @@ def _update_codec_configs_at_pipeline_level(self, total_num_frames):
175175 self ._codec_skip_n_frames = self .configs ["codec" ]["skip_n_frames" ]
176176 n_frames_to_be_encoded = self .configs ["codec" ]["n_frames_to_be_encoded" ]
177177
178- assert self . _codec_skip_n_frames < total_num_frames , (
179- f"Number of skip frames { self ._codec_skip_n_frames } must be less than total number of frames { total_num_frames } "
180- )
178+ assert (
179+ self ._codec_skip_n_frames < total_num_frames
180+ ), f"Number of skip frames { self . _codec_skip_n_frames } must be less than total number of frames { total_num_frames } "
181181
182182 if n_frames_to_be_encoded == - 1 :
183183 n_frames_to_be_encoded = total_num_frames
184184
185- assert n_frames_to_be_encoded , (
186- f"Number of frames to be encoded must be greater than 0, but got { n_frames_to_be_encoded } "
187- )
185+ assert n_frames_to_be_encoded , f"Number of frames to be encoded must be greater than 0, but got { n_frames_to_be_encoded } "
188186
189187 if (self ._codec_skip_n_frames + n_frames_to_be_encoded ) > total_num_frames :
190188 self .logger .warning (
@@ -202,9 +200,11 @@ def _update_codec_configs_at_pipeline_level(self, total_num_frames):
202200 self ._codec_skip_n_frames > 0
203201 or self ._codec_n_frames_to_be_encoded != total_num_frames
204202 ):
205- assert self .configs ["codec" ]["encode_only" ], (
206- "Encoding part of a sequence is only available when `codec.encode_only' is True"
207- )
203+ assert self .configs [
204+ "codec"
205+ ][
206+ "encode_only"
207+ ], "Encoding part of a sequence is only available when `codec.encode_only' is True"
208208
209209 self ._codec_end_frame_idx = (
210210 self ._codec_skip_n_frames + self ._codec_n_frames_to_be_encoded
@@ -219,18 +219,18 @@ def _prep_features_to_dump(features, n_bits, datacatalog_name):
219219 if n_bits == - 1 :
220220 data_features = features ["data" ]
221221 elif n_bits >= 8 :
222- assert n_bits == 8 or n_bits == 16 , (
223- "currently it only supports dumping features in 8 bits or 16 bits"
224- )
225- assert datacatalog_name in list ( MIN_MAX_DATASET . keys ()), (
226- f" { datacatalog_name } does not exist in the pre-computed minimum and maximum tables"
227- )
222+ assert (
223+ n_bits == 8 or n_bits == 16
224+ ), "currently it only supports dumping features in 8 bits or 16 bits"
225+ assert (
226+ datacatalog_name in list ( MIN_MAX_DATASET . keys ())
227+ ), f" { datacatalog_name } does not exist in the pre-computed minimum and maximum tables"
228228 minv , maxv = MIN_MAX_DATASET [datacatalog_name ]
229229 data_features = {}
230230 for key , data in features ["data" ].items ():
231- assert data . min () >= minv and data . max () <= maxv , (
232- f" { data .min ()} should be greater than { minv } and { data .max ()} should be less than { maxv } "
233- )
231+ assert (
232+ data .min () >= minv and data .max () <= maxv
233+ ), f" { data . min () } should be greater than { minv } and { data . max () } should be less than { maxv } "
234234 out , _ = min_max_normalization (data , minv , maxv , bitdepth = n_bits )
235235
236236 if n_bits <= 8 :
@@ -258,12 +258,12 @@ def _post_process_loaded_features(features, n_bits, datacatalog_name):
258258 if n_bits == - 1 :
259259 assert "data" in features
260260 elif n_bits >= 8 :
261- assert n_bits == 8 or n_bits == 16 , (
262- "currently it only supports dumping features in 8 bits or 16 bits"
263- )
264- assert datacatalog_name in list ( MIN_MAX_DATASET . keys ()), (
265- f" { datacatalog_name } does not exist in the pre-computed minimum and maximum tables"
266- )
261+ assert (
262+ n_bits == 8 or n_bits == 16
263+ ), "currently it only supports dumping features in 8 bits or 16 bits"
264+ assert (
265+ datacatalog_name in list ( MIN_MAX_DATASET . keys ())
266+ ), f" { datacatalog_name } does not exist in the pre-computed minimum and maximum tables"
267267 minv , maxv = MIN_MAX_DATASET [datacatalog_name ]
268268 data_features = {}
269269 for key , data in features ["data" ].items ():
0 commit comments