utils
Utilities not easily categorized.
Functions¶
echo
¶
echo(
message: Optional[Any] = None,
file: Optional[IO] = None,
nl: bool = True,
err: bool = False,
color: Optional[bool] = None,
**styles: Any
) -> None
A local abstraction for printing messages.
Default behavior is that of click.secho.
This is to allow user feedback without every function requiring a click dependency. Especially during testing.
Parameters:
message
-
The string or bytes to output. Other objects are converted to strings.
DEFAULT:
None
file
-
The file to write to. Defaults to stdout.
DEFAULT:
None
nl
-
Print a newline after the message. Enabled by default.
TYPE:
bool
DEFAULT:
True
err
-
Write to stderr instead of stdout.
TYPE:
bool
DEFAULT:
False
color
-
Force showing or hiding colors and other styles. By default Click will remove color if the output does not look like an interactive terminal.
DEFAULT:
None
**styles
-
Style keyword arguments
TYPE:
Any
DEFAULT:
{}
get_deleted_files
¶
get_deleted_files(
template_dir: Path, project_dir: Path
) -> Set[Path]
Get a list of files in the rendered template that do not exist in the project.
This is to avoid introducing changes that won’t apply cleanly to the current project.
Nabbed from Cruft: https://github.com/cruft/cruft/
Parameters:
template_dir
-
The path to the directory rendered with the same context as the project
TYPE:
Path
project_dir
-
The path to the current project
TYPE:
Path
Returns:
remove_paths
¶
remove_paths(
root: Path, paths_to_remove: Set[Path]
) -> None
remove_readonly_bit
¶
remove_readonly_bit(
func: Callable[[str], None], path: str, _: Any
) -> None
Clear the readonly bit and reattempt the removal.
remove_single_path
¶
remove_single_path(path: Path) -> None