summaryrefslogtreecommitdiffstats
path: root/port_for/utils.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 05:38:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 05:38:43 +0000
commit1dd702b721f7d1836af27c8a114f1386ff9f57bd (patch)
tree622a84466e38b4480dbbbdfa64263da19d736e2f /port_for/utils.py
parentAdding upstream version 0.7.1. (diff)
downloadport-for-upstream/0.7.2.tar.xz
port-for-upstream/0.7.2.zip
Adding upstream version 0.7.2.upstream/0.7.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'port_for/utils.py')
-rw-r--r--port_for/utils.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/port_for/utils.py b/port_for/utils.py
index 361d5c0..997f63a 100644
--- a/port_for/utils.py
+++ b/port_for/utils.py
@@ -1,11 +1,10 @@
-# -*- coding: utf-8 -*-
+"""Port for utils."""
import itertools
-from typing import Iterable, Iterator, Tuple, Set
+from typing import Iterable, Iterator, Set, Tuple
def ranges_to_set(lst: Iterable[Tuple[int, int]]) -> Set[int]:
- """
- Convert a list of ranges to a set of numbers::
+ """Convert a list of ranges to a set of numbers.
>>> ranges = [(1,3), (5,6)]
>>> sorted(list(ranges_to_set(ranges)))
@@ -16,8 +15,7 @@ def ranges_to_set(lst: Iterable[Tuple[int, int]]) -> Set[int]:
def to_ranges(lst: Iterable[int]) -> Iterator[Tuple[int, int]]:
- """
- Convert a list of numbers to a list of ranges::
+ """Convert a list of numbers to a list of ranges.
>>> numbers = [1,2,3,5,6]
>>> list(to_ranges(numbers))