Skip to content

Commit 2390f96

Browse files
aarmeyclaude
andcommitted
fix: Narrow compress type before compress_dataset call for ty
The compression_kwarg None/False validation was in a separate if-block from the compress_dataset call, so ty couldn't narrow away compress's None case at the call site. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent b932416 commit 2390f96

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎scrise/_pf2_utils.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,10 @@ def run_parafac2(
4444
normalize_slices = parafac2_kwarg.pop("normalize_slices", normalize_slices)
4545
backend = parafac2_kwarg.pop("backend", backend)
4646

47-
if compression_kwarg and (compress is None or compress is False):
48-
raise ValueError("compression_kwarg requires compress to be set.")
49-
5047
X_in: anndata.AnnData | CompressedData = X
5148
if compression_kwarg:
49+
if compress is None or compress is False:
50+
raise ValueError("compression_kwarg requires compress to be set.")
5251
X_in = compress_dataset(
5352
X,
5453
L=compress,

0 commit comments

Comments
 (0)