update#

Disk utility functions for modifying existing files or directories.

Functions#

update_file_in_place_as_binary(file_full_path, callback)

rename(source_path, destination_path[, force])

rename_context(source[, destination, dry_run])

Used for removing a directory when there are dependent actions (i.e. you need to ensure

backoff_rename(source_path, destination_path[, force])

touch(path[, mkdir, sudo_safe])

Attributes#

SHEBANG_REGEX#
exception CancelOperation#

Bases: Exception

Common base class for all non-exit exceptions.

Initialize self. See help(type(self)) for accurate signature.

update_file_in_place_as_binary(file_full_path, callback)#
rename(source_path, destination_path, force=False)#
rename_context(source: str, destination: str | None = None, dry_run: bool = False)#

Used for removing a directory when there are dependent actions (i.e. you need to ensure other actions succeed before removing it).

Example

with rename_context(directory):

# Do dependent actions here

backoff_rename(source_path, destination_path, force=False)#
touch(path, mkdir=False, sudo_safe=False)#