Spaces:
Runtime error
Runtime error
File size: 400 Bytes
47c46ea |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import os
from typing import Iterable
def optional_string(condition: bool, string: str):
return string if condition else ""
def parent_dir(path: str) -> str:
return os.path.basename(os.path.dirname(path))
def stem(path: str) -> str:
return os.path.splitext(os.path.basename(path))[0]
def iterable_to_str(iterable: Iterable) -> str:
return ','.join([str(x) for x in iterable])
|