MCPcopy Create free account
hub / github.com/google-research/language / safe_zip

Function safe_zip

language/conpono/reconstruct/preprocess.py:197–203  ·  view source on GitHub ↗

Like builtin `zip`, but checks that iterables have same length.

(*iterables)

Source from the content-addressed store, hash-verified

195
196
197def safe_zip(*iterables):
198 """Like builtin `zip`, but checks that iterables have same length."""
199 n = len(iterables[0])
200 for iterable in iterables:
201 if len(iterable) != n:
202 raise ValueError("Zipped items must all have same length.")
203 return zip(*iterables)
204
205
206def whitespace_align_seqs(seqs):

Callers 2

whitespace_align_seqsFunction · 0.85
pretty_printMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…