From 2327d5388dc93f1e5d6255dcfde567ef523c0ba2 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 17 Sep 2024 23:32:51 +0200 Subject: [PATCH] doc/get_path_uuid --- rwx/fs/__init__.py | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/rwx/fs/__init__.py b/rwx/fs/__init__.py index 5767015..6abcce7 100644 --- a/rwx/fs/__init__.py +++ b/rwx/fs/__init__.py @@ -33,27 +33,44 @@ def empty_file(path: Path) -> None: write(path, "") -def get_mount_uuid(path: str) -> str: - """Return the filesystem UUID of a mountpoint path.""" +def get_mount_uuid(path: Path) -> str: + """Return the filesystem UUID of a mountpoint path. + + :param path: mountpoint path + :type path: Path + :rtype: str + """ return ps.run_line( - ("findmnt",), - ("--noheadings",), + "findmnt", + "--noheadings", ("--output", "UUID"), - (path,), + str(path), ) -def get_path_mount(path: str) -> str: - """Return the mountpoint path of an arbitrary path.""" - return ps.run_line( - "stat", - ("--format", "%m"), - path, +def get_path_mount(path: Path) -> Path: + """Return the mountpoint path of an arbitrary path. + + :param path: arbitrary path + :type path: Path + :rtype: Path + """ + return Path( + ps.run_line( + "stat", + ("--format", "%m"), + str(path), + ) ) -def get_path_uuid(path: str) -> str: - """Return the filesystem UUID of an arbitrary path.""" +def get_path_uuid(path: Path) -> str: + """Return the filesystem UUID of an arbitrary path. + + :param path: arbitrary path + :type path: Path + :rtype: str + """ return get_mount_uuid(get_path_mount(path))