@@ -63,9 +63,7 @@ def partition_bucket(doc_id: str) -> int:
6363def bucket_to_split (bucket : int ) -> str :
6464 """Map a partition bucket to its split using the fixed/pinned boundaries."""
6565 if not 0 <= bucket < PARTITION_MODULUS :
66- raise LockedDatasetError (
67- f"partition bucket { bucket } out of range [0, { PARTITION_MODULUS } )"
68- )
66+ raise LockedDatasetError (f"partition bucket { bucket } out of range [0, { PARTITION_MODULUS } )" )
6967 for split , (low , high ) in PARTITION_BUCKETS .items ():
7068 if low <= bucket <= high :
7169 return split
@@ -171,9 +169,7 @@ def to_dict(self) -> dict[str, Any]:
171169 "partition" : self .partition ,
172170 "tokenizer" : dict (self .tokenizer ),
173171 "splits" : {
174- name : self .splits [name ].to_dict ()
175- for name in LOCKED_SPLITS
176- if name in self .splits
172+ name : self .splits [name ].to_dict () for name in LOCKED_SPLITS if name in self .splits
177173 },
178174 }
179175
@@ -319,8 +315,7 @@ def verify_locked_manifest(
319315 actual = hashlib .sha256 (data ).hexdigest ()
320316 if actual != shard .sha256 :
321317 problems .append (
322- f"sha256 mismatch for { shard .path } : "
323- f"manifest { shard .sha256 } != on-disk { actual } "
318+ f"sha256 mismatch for { shard .path } : manifest { shard .sha256 } != on-disk { actual } "
324319 )
325320 if len (data ) != shard .bytes :
326321 problems .append (
@@ -345,9 +340,7 @@ def verify_locked_manifest_or_raise(
345340) -> None :
346341 problems = verify_locked_manifest (root , manifest , splits = splits )
347342 if problems :
348- raise LockedDatasetError (
349- "locked dataset integrity check failed: " + "; " .join (problems )
350- )
343+ raise LockedDatasetError ("locked dataset integrity check failed: " + "; " .join (problems ))
351344
352345
353346def locked_shard_paths (manifest : LockedManifest , split : str ) -> list [str ]:
@@ -405,9 +398,7 @@ def iter_locked_documents(root: Path | str, split: str) -> Iterator[LockedDocume
405398 doc_id = str (record ["id" ])
406399 text = record ["text" ]
407400 except (json .JSONDecodeError , KeyError , TypeError ) as exc :
408- raise LockedDatasetError (
409- f"malformed locked shard line { rel } :{ offset } "
410- ) from exc
401+ raise LockedDatasetError (f"malformed locked shard line { rel } :{ offset } " ) from exc
411402 if not isinstance (text , str ):
412403 raise LockedDatasetError (f"locked shard line { rel } :{ offset } has non-string text" )
413404 yield LockedDocument (doc_id = doc_id , text = text , shard = rel , offset = offset , index = index )
0 commit comments