From 3cd203f55293cba14bddaf3272cd27ce2251afd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@ericsson.com> Date: Mon, 12 Aug 2024 22:14:11 +0200 Subject: [PATCH] build fix --- snakehouse/satella.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/snakehouse/satella.py b/snakehouse/satella.py index 970813a..58a64f7 100644 --- a/snakehouse/satella.py +++ b/snakehouse/satella.py @@ -6,6 +6,14 @@ snakehouse. import typing as tp +def _has_separator(path: str) -> bool: + # handle Windows case + if len(path) == 3: + if path.endswith(':/') or path.endswith(':\\'): + return False + return any(map(lambda x: x in path, SEPARATORS)) + + def find_files(path: str, wildcard: str = r'(.*)', prefix_with: tp.Optional[str] = None, scan_subdirectories: bool = True, @@ -57,9 +65,20 @@ def split(path: str) -> tp.List[str]: Is is true that + >>> os.path.join(split(a)) == a + """ + data = list(os.path.split(path)) + while _has_separdef split(path: str) -> tp.List[str]: + """ + An exact reverse of os.path.join + + Is is true that + >>> os.path.join(split(a)) == a """ data = list(os.path.split(path)) while _has_separator(data[0]): data = list(os.path.split(data[0])) + data[1:] + return dataator(data[0]): + data = list(os.path.split(data[0])) + data[1:] return data \ No newline at end of file -- GitLab