Download scDFM/src/utils/_utils.py from tintin1027/final: direct link, hf CLI and curl.
- Browser
- Download file 427 Bytes
-
https://huggingface.co/tintin1027/final/resolve/main/scDFM/src/utils/_utils.py
- Command line
-
hf download hf://tintin1027/final/scDFM/src/utils/_utils.py
-
curl -L -o _utils.py https://huggingface.co/tintin1027/final/resolve/main/scDFM/src/utils/_utils.py
427 Bytes
| from collections.abc import Iterable | |
| from typing import Any | |
| def _to_list(x: list[Any] | tuple[Any] | Any) -> list[Any] | tuple[Any]: | |
| """Converts x to a list if it is not already a list or tuple.""" | |
| if isinstance(x, (list | tuple)): | |
| return x | |
| return [x] | |
| def _flatten_list(x: Iterable[Iterable[Any]]) -> list[Any]: | |
| """Flattens a list of lists.""" | |
| return [item for sublist in x for item in sublist] | |