generate_changelog.utilities.pairs

pairs#

generate_changelog.utilities.pairs(iterable)[source]#

Return successive pairs taken from the input iterable.

Like itertools.pairwise() in 3.10, but will always include the last element by itself.

Example

>>> list(pairs("ABCD"))
[("A", "B"), ("B", "C"), ("C", "D"), ("D", None)]
>>> list(pairs("ABC"))
[("A", "B"), ("B", "C"), ("C", None)]
Parameters:

iterable (Iterable) – The iterable to combine into pairs.

Return type:

Iterable

Returns:

An iterable of pairs.