MCPcopy
hub / github.com/Vchitect/Latte / remove_root

Function remove_root

tools/utils/dataset.py:486–495  ·  view source on GitHub ↗

`root_name` should NOT start with '/

(fname: os.PathLike, root_name: os.PathLike)

Source from the content-addressed store, hash-verified

484#----------------------------------------------------------------------------
485
486def remove_root(fname: os.PathLike, root_name: os.PathLike):
487 """`root_name` should NOT start with '/'"""
488 if fname == root_name or fname == ('/' + root_name):
489 return ''
490 elif fname.startswith(root_name + '/'):
491 return fname[len(root_name) + 1:]
492 elif fname.startswith('/' + root_name + '/'):
493 return fname[len(root_name) + 2:]
494 else:
495 return fname
496
497#----------------------------------------------------------------------------

Callers 1

_load_raw_labelsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected