Coverage for src/edwh_restic_plugin/helpers.py: 83%

1 import typing

2

3 T = typing.TypeVar("T")

4

5

6 def fix_tags(tags: typing.Iterable[T | None]) -> list[T]:

7 """

8 Removes all None type elements from the input list.

9

10 :param tags: list of strings, some elements may be None

11 :return: list of strings with all None elements removed

12 """

13 return [tag for tag in tags if tag is not None]

14

15

16 def camel_to_snake(s: str) -> str:

17 return "".join([f"_{c.lower()}" if c.isupper() else c for c in s]).lstrip("_")