MCPcopy Create free account
hub / github.com/celery/celery / seq_concat_seq

Function seq_concat_seq

celery/utils/functional.py:486–501  ·  view source on GitHub ↗

Concatenate two sequences: ``a + b``. Returns: Sequence: The return value will depend on the largest sequence - if b is larger and is a tuple, the return value will be a tuple. - if a is larger and is a list, the return value will be a list,

(a, b)

Source from the content-addressed store, hash-verified

484
485
486def seq_concat_seq(a, b):
487 """Concatenate two sequences: ``a + b``.
488
489 Returns:
490 Sequence: The return value will depend on the largest sequence
491 - if b is larger and is a tuple, the return value will be a tuple.
492 - if a is larger and is a list, the return value will be a list,
493 """
494 # find the type of the largest sequence
495 prefer = type(max([a, b], key=len))
496 # convert the smallest list to the type of the largest sequence.
497 if not isinstance(a, prefer):
498 a = prefer(a)
499 if not isinstance(b, prefer):
500 b = prefer(b)
501 return a + b
502
503
504def is_numeric_value(value):

Callers 2

test_seq_concat_seqFunction · 0.90
__or__Method · 0.90

Calls

no outgoing calls

Tested by 1

test_seq_concat_seqFunction · 0.72