OS functions
Sometimes some OS functions are necessary and they are collected here:
OS interaction of DMT
- class DMT.external.os.cd(newPath)[source]
Bases:
object
Context manager for changing the current working directory
Usage:
with cd(dir): pass
- DMT.external.os.recursive_copy(src, dst, force=False)[source]
Recursively copies a full directory to a new destination folder.
- DMT.external.os.rmtree(root)[source]
rmtree method for Path objects
- Parameters:
- root
str
oros.Pathlike
Directory to remove
- root
- DMT.external.os.slugify(s: str) str [source]
https://stackoverflow.com/questions/295135/turn-a-string-into-a-valid-filename Normalizes string, converts to lowercase, removes non-alpha characters, and converts spaces to hyphens.