daklib.fstransactions

Transactions for filesystem actions

Classes

FilesystemTransaction()

transactions for filesystem actions

class daklib.fstransactions.FilesystemTransaction[source]

transactions for filesystem actions

commit()[source]

Commit all recorded actions.

copy(source: str, destination: str, link: bool = False, symlink: bool = False, mode: Optional[int] = None) None[source]

copy source to destination

Parameters:
  • source – source file

  • destination – destination file

  • link – try hardlinking, falling back to copying

  • symlink – create a symlink instead of copying

  • mode – permissions to change destination to

create(path: str, mode: Optional[int] = None, text: bool = True) IO[source]

create filename and return file handle

Parameters:
  • path – file to create

  • mode – permissions for the new file

  • text – open file in text mode

Returns:

file handle of the new file

move(source: str, destination: str, mode: Optional[int] = None) None[source]

move source to destination

Parameters:
  • source – source file

  • destination – destination file

  • mode – permissions to change destination to

rollback()[source]

Undo all recorded actions.

unlink path

Parameters:

path – file to unlink

class daklib.fstransactions._FilesystemAction[source]
check_for_temporary() None[source]
property temporary_name: str
class daklib.fstransactions._FilesystemCopyAction(source, destination, link=True, symlink=False, mode=None)[source]
commit()[source]
rollback()[source]
property temporary_name
class daklib.fstransactions._FilesystemCreateAction(path: str)[source]
commit() None[source]
rollback() None[source]
property temporary_name: str
class daklib.fstransactions._FilesystemUnlinkAction(path: str)[source]
commit() None[source]
rollback() None[source]
property temporary_name: str