MCPcopy
hub / github.com/InstaPy/InstaPy / verify_workspace_name

Function verify_workspace_name

instapy/file_manager.py:164–181  ·  view source on GitHub ↗

Make sure chosen workspace name is InstaPy friendly

(path)

Source from the content-addressed store, hash-verified

162
163
164def verify_workspace_name(path):
165 """Make sure chosen workspace name is InstaPy friendly"""
166
167 path = slashen(path)
168 path = remove_last_slash(path)
169 custom_workspace_name = path.split("/")[-1]
170 default_workspace_name = WORKSPACE["name"]
171
172 if default_workspace_name not in custom_workspace_name:
173 if default_workspace_name.lower() not in custom_workspace_name.lower():
174 path += "/{}".format(default_workspace_name)
175 else:
176 nicer_name = custom_workspace_name.lower().replace(
177 default_workspace_name.lower(), default_workspace_name
178 )
179 path = path.replace(custom_workspace_name, nicer_name)
180
181 return path
182
183
184def differ_paths(old, new):

Callers 2

get_workspaceFunction · 0.85
set_workspaceFunction · 0.85

Calls 2

slashenFunction · 0.85
remove_last_slashFunction · 0.85

Tested by

no test coverage detected