Paths Provider¶
Hooks for file path operations including symlinking
Hooks¶
Type | Description | Return |
---|---|---|
basename | Hook for getting the basename from a path. | None |
dirname | Hook for getting the basename from a path. | None |
find_in_child | Hook to find the absolute path to a file or directory in child directories. | list |
find_in_parent | Hook to find the absolute path to a file or directory in parent directories. | str |
flatten_paths | Hook for flattening a dictionary into a list of paths. | list |
glob | Hook for running python's glob module. Return a possibly empty list of path names that match pathname, which must be a string containing a path specification. | list |
isdir | Hook for os package 'path.isdir'. | bool |
isfile | Hook for os package 'path.isfile'. | bool |
listdir | Hook for listdir . Lists the contents of a directory. |
list |
mkdir | Hook creating a directory. | str |
path_exists | Hook for os package 'path.exists'. | bool |
path_join | Hook joining paths. | None |
symlink | Hook creating symlinks wrapping os.symlink functionality. Wrapsos.symlink |
NoneType |
temp_dir | Hook creating a temporary directory. | str |
Examples¶
mkdir¶
Make a directory
compact->: mkdir path/to/dir
expanded:
->: mkdir
path: path/to/dir
listdir¶
List the contents of a directory
compact->: listdir path/to/dir
expanded:
->: listdir
path: path/to/dir
symlink¶
Create a symlink
compact->: symlink path/to/source path/to/destination
expanded:
->: symlink
src: path/to/source
dst: path/to/destination
target_is_directory: true
path_exists¶
Check if a path exists
compact->: path_exists path/to/file/or/dir
expanded:
->: path_exists
path: path/to/file/or/dir
isdir¶
Check if a path exists
compact->: isdir path/to/dir
expanded:
->: isdir
path: path/to/dir
isfile¶
Check if a path exists
compact->: isfile path/to/dir
expanded:
->: isfile
path: path/to/dir
path_join¶
Check if a path exists
compact->: path_join ['path','to','dir']
expanded:
->: path_join
paths:
- path
- to
- dir
compact: path/to/dir # \ for windows
expanded: path/to/dir
find_in_parent¶
Return the path to a target file in a parent directory
compact->: find_in_parent a-file.yaml
expanded:
->: find_in_parent
target: a-file.yaml
find_in_child¶
Get a list of paths to a target file in child directories
compact->: find_in_child a-file.yaml
expanded:
->: find_in_child
target: a-file.yaml