|
10 | 10 | import urllib.error |
11 | 11 | from collections import OrderedDict |
12 | 12 | from shutil import rmtree |
13 | | -from typing import Union |
| 13 | +from typing import Iterable, Union |
14 | 14 |
|
15 | 15 | from cfbs.pretty import pretty |
16 | 16 |
|
@@ -180,29 +180,29 @@ def item_index(iterable, item, extra_at_end=True): |
180 | 180 | return -1 |
181 | 181 |
|
182 | 182 |
|
183 | | -def strip_right(string, ending): |
| 183 | +def strip_right(string: str, ending) -> str: |
184 | 184 | # can be replaced with str.removesuffix from Python 3.9 onwards |
185 | 185 | if not string.endswith(ending): |
186 | 186 | return string |
187 | 187 | return string[0 : -len(ending)] |
188 | 188 |
|
189 | 189 |
|
190 | | -def strip_left(string, beginning): |
| 190 | +def strip_left(string: str, beginning) -> str: |
191 | 191 | # can be replaced with str.removeprefix from Python 3.9 onwards |
192 | 192 | if not string.startswith(beginning): |
193 | 193 | return string |
194 | 194 | return string[len(beginning) :] |
195 | 195 |
|
196 | 196 |
|
197 | | -def strip_right_any(string, suffixes): |
| 197 | +def strip_right_any(string: str, suffixes: Iterable[str]) -> str: |
198 | 198 | for suffix in suffixes: |
199 | 199 | if string.endswith(suffix): |
200 | 200 | return string[0 : -len(suffix)] |
201 | 201 |
|
202 | 202 | return string |
203 | 203 |
|
204 | 204 |
|
205 | | -def strip_left_any(string, prefixes): |
| 205 | +def strip_left_any(string: str, prefixes: Iterable[str]) -> str: |
206 | 206 | for prefix in prefixes: |
207 | 207 | if string.startswith(prefix): |
208 | 208 | return string[len(prefix) :] |
|
0 commit comments