|
13 | 13 | import posixpath |
14 | 14 | import re |
15 | 15 | import shutil |
16 | | -import sys |
17 | 16 | import warnings |
| 17 | +from bisect import insort # noqa: F401 - legacy re-export |
18 | 18 | from collections import defaultdict |
19 | | -from collections.abc import Collection, Iterable, MutableSequence |
| 19 | +from collections.abc import Collection, Iterable |
20 | 20 | from datetime import datetime, timezone |
| 21 | +from importlib.metadata import EntryPoint, entry_points |
21 | 22 | from pathlib import PurePath |
22 | 23 | from typing import TYPE_CHECKING, TypeVar |
23 | 24 | from urllib.parse import urlsplit |
24 | 25 |
|
25 | | -if sys.version_info >= (3, 10): |
26 | | - from importlib.metadata import EntryPoint, entry_points |
27 | | -else: |
28 | | - from importlib_metadata import EntryPoint, entry_points |
29 | | - |
30 | 26 | from properdocs import exceptions |
31 | 27 | from properdocs.utils.yaml import get_yaml_loader, yaml_load # noqa: F401 - legacy re-export |
32 | 28 |
|
@@ -93,18 +89,6 @@ def reduce_list(data_set: Iterable[T]) -> list[T]: |
93 | 89 | return list(dict.fromkeys(data_set)) |
94 | 90 |
|
95 | 91 |
|
96 | | -if sys.version_info >= (3, 10): |
97 | | - from bisect import insort |
98 | | -else: |
99 | | - |
100 | | - def insort(a: MutableSequence[T], x: T, *, key=lambda v: v) -> None: |
101 | | - kx = key(x) |
102 | | - i = len(a) |
103 | | - while i > 0 and kx < key(a[i - 1]): |
104 | | - i -= 1 |
105 | | - a.insert(i, x) |
106 | | - |
107 | | - |
108 | 92 | def copy_file(source_path: str, output_path: str) -> None: |
109 | 93 | """ |
110 | 94 | Copy source_path to output_path, making sure any parent directories exist. |
|
0 commit comments