lint fs
This commit is contained in:
parent
c7db231dc2
commit
592023d214
1 changed files with 10 additions and 10 deletions
|
@ -3,13 +3,13 @@ import shutil
|
||||||
|
|
||||||
from rwx import ps
|
from rwx import ps
|
||||||
|
|
||||||
CHARSET = 'UTF-8'
|
CHARSET = "UTF-8"
|
||||||
|
|
||||||
|
|
||||||
def create_image(file_path: str, size_bytes: int):
|
def create_image(file_path: str, size_bytes: int):
|
||||||
ps.run(
|
ps.run(
|
||||||
('qemu-img', 'create'),
|
("qemu-img", "create"),
|
||||||
('-f', 'qcow2'),
|
("-f", "qcow2"),
|
||||||
(file_path, size_bytes),
|
(file_path, size_bytes),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -20,17 +20,17 @@ def empty_file(path: str):
|
||||||
|
|
||||||
def get_mount_uuid(path: str):
|
def get_mount_uuid(path: str):
|
||||||
return ps.run_line(
|
return ps.run_line(
|
||||||
('findmnt',),
|
("findmnt",),
|
||||||
('--noheadings',),
|
("--noheadings",),
|
||||||
('--output', 'UUID'),
|
("--output", "UUID"),
|
||||||
(path,),
|
(path,),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_path_mount(path: str):
|
def get_path_mount(path: str):
|
||||||
return ps.run_line(
|
return ps.run_line(
|
||||||
('stat',),
|
("stat",),
|
||||||
('--format', '%m'),
|
("--format", "%m"),
|
||||||
(path,),
|
(path,),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ def make_directory(path: str):
|
||||||
|
|
||||||
|
|
||||||
def read_file(file_path: str):
|
def read_file(file_path: str):
|
||||||
with open(file_path, 'br') as file_object:
|
with open(file_path, "br") as file_object:
|
||||||
return file_object.read()
|
return file_object.read()
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,5 +66,5 @@ def wipe(path: str):
|
||||||
|
|
||||||
|
|
||||||
def write(file_path: str, text: str, charset=CHARSET):
|
def write(file_path: str, text: str, charset=CHARSET):
|
||||||
with open(file_path, 'bw') as file_object:
|
with open(file_path, "bw") as file_object:
|
||||||
file_object.write(text.encode(charset))
|
file_object.write(text.encode(charset))
|
||||||
|
|
Loading…
Reference in a new issue