Skip to content

Commit b297129

Browse files
committed
PY39: Define strict zip if not builtin
1 parent dac204c commit b297129

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

niworkflows/interfaces/bids.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import shutil
2929
import os
3030
import re
31+
import sys
3132

3233
import nibabel as nb
3334
import numpy as np
@@ -64,6 +65,15 @@
6465
LOGGER = logging.getLogger("nipype.interface")
6566

6667

68+
if sys.version_info < (3, 10): # PY39
69+
builtin_zip = zip
70+
71+
def zip(*args, strict=False):
72+
if strict and any(len(args[0]) != len(arg) for arg in args):
73+
raise ValueError("strict_zip() requires all arguments to have the same length")
74+
return builtin_zip(*args)
75+
76+
6777
def _none():
6878
return None
6979

0 commit comments

Comments
 (0)