mirror of
https://github.com/Faraphel/Atlas-Install.git
synced 2025-07-05 20:28:27 +02:00
simplified cat_data to use list instead of dict
This commit is contained in:
parent
d70f6911b2
commit
448170dad9
3 changed files with 7 additions and 9 deletions
|
@ -14,7 +14,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"mode": "patch",
|
"mode": "patch",
|
||||||
"patchs": {"LE-FORCE-COPY": null}
|
"patchs": ["LE-FORCE-COPY"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"mode": "patch",
|
"mode": "patch",
|
||||||
"patchs": {"LE-FORCE-COPY": null}
|
"patchs": ["LE-FORCE-COPY"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -31,20 +31,18 @@ def encode_data(txt_data: str) -> bytes:
|
||||||
return stdout
|
return stdout
|
||||||
|
|
||||||
|
|
||||||
def cat_data(txt_data: str, patchs: dict[str, str | None] = None, filters: dict[str, str | None] = None) -> str:
|
def cat_data(txt_data: str, patchs: list[str] = None, filters: list[str] = None) -> str:
|
||||||
"""
|
"""
|
||||||
Patch and filter a bmgtxt file (for example LE-COPY).
|
Patch and filter a bmgtxt file (for example LE-COPY).
|
||||||
:patchs: dictionary of patchs bmg key and value
|
:patchs: dictionary of patchs bmg key and value
|
||||||
"""
|
"""
|
||||||
args = []
|
args = []
|
||||||
|
|
||||||
for key, value in filters.items() if filters is not None else {}:
|
for filter_ in filters if filters is not None else []:
|
||||||
args.append("--filter-bmg")
|
args.extend(["--filter-bmg", filter_])
|
||||||
args.append(key if value is None else f"{key}={value}")
|
|
||||||
|
|
||||||
for key, value in patchs.items() if patchs is not None else {}:
|
for patch in patchs if patchs is not None else []:
|
||||||
args.append("--patch-bmg")
|
args.extend(["--patch-bmg", patch])
|
||||||
args.append(key if value is None else f"{key}={value}")
|
|
||||||
|
|
||||||
process = _tools_run_popen("CAT", "-", *args)
|
process = _tools_run_popen("CAT", "-", *args)
|
||||||
stdout, _ = process.communicate(input=txt_data.encode("utf-8"))
|
stdout, _ = process.communicate(input=txt_data.encode("utf-8"))
|
||||||
|
|
Loading…
Reference in a new issue