MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / path_components

Function path_components

keepercommander/importer/importer.py:74–93  ·  view source on GitHub ↗
(path, delimiter=PathDelimiter)

Source from the content-addressed store, hash-verified

72
73
74def path_components(path, delimiter=PathDelimiter): # type: (str, str) -> Iterable[str]
75 p = path.strip()
76 pos = 0
77 while pos < len(p):
78 idx = p.find(delimiter, pos)
79 if idx >= 0:
80 if idx+1 < len(p):
81 if p[idx+1] == delimiter:
82 pos = idx + 2
83 continue
84 comp = p[:idx].strip()
85 p = p[idx+1:].strip()
86 pos = 0
87 if len(comp) > 0:
88 yield comp.replace(2*delimiter, delimiter)
89 else:
90 p = strip_path_delimiter(p, delimiter=delimiter)
91 if len(p) > 0:
92 yield p.replace(2*delimiter, delimiter)
93 p = ''
94
95
96def check_if_bool(value):

Callers 4

import_user_permissionsFunction · 0.85
_importFunction · 0.85
prepare_folder_addFunction · 0.85
do_exportMethod · 0.85

Calls 1

strip_path_delimiterFunction · 0.85

Tested by

no test coverage detected