lint/fs
This commit is contained in:
parent
08b6364d9b
commit
3e0d5bf2bc
1 changed files with 7 additions and 4 deletions
|
@ -23,7 +23,7 @@ def empty_file(path: str) -> None:
|
||||||
|
|
||||||
|
|
||||||
def get_mount_uuid(path: str) -> str:
|
def get_mount_uuid(path: str) -> str:
|
||||||
"""Return the UUID of provided mountpoint path."""
|
"""Return the filesystem UUID of a mountpoint path."""
|
||||||
return ps.run_line(
|
return ps.run_line(
|
||||||
("findmnt",),
|
("findmnt",),
|
||||||
("--noheadings",),
|
("--noheadings",),
|
||||||
|
@ -32,7 +32,8 @@ def get_mount_uuid(path: str) -> str:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_path_mount(path: str):
|
def get_path_mount(path: str) -> str:
|
||||||
|
"""Return the mountpoint path of an arbitrary path."""
|
||||||
return ps.run_line(
|
return ps.run_line(
|
||||||
("stat",),
|
("stat",),
|
||||||
("--format", "%m"),
|
("--format", "%m"),
|
||||||
|
@ -40,11 +41,13 @@ def get_path_mount(path: str):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_path_uuid(path: str):
|
def get_path_uuid(path: str) -> str:
|
||||||
|
"""Return the filesystem UUID of an arbitrary path."""
|
||||||
return get_mount_uuid(get_path_mount(path))
|
return get_mount_uuid(get_path_mount(path))
|
||||||
|
|
||||||
|
|
||||||
def make_directory(path: str):
|
def make_directory(path: str) -> None:
|
||||||
|
"""Make a directory (and its parents) from a path."""
|
||||||
os.makedirs(path, exist_ok=True)
|
os.makedirs(path, exist_ok=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue