Обновление структуры проекта, использование pydantic для конфигураций, улучшение отчёта о патчах
Build mod / build (push) Successful in 6m39s
Build mod / build (push) Successful in 6m39s
This commit is contained in:
@@ -12,10 +12,16 @@ priority = 0
|
||||
import os
|
||||
from tqdm import tqdm
|
||||
from lxml import etree
|
||||
from typing import Dict, Any
|
||||
|
||||
from utils.config import PatchConfig
|
||||
from utils.smali_parser import get_smali_lines, save_smali_lines
|
||||
|
||||
#Config
|
||||
class Config(PatchConfig): ...
|
||||
|
||||
# Patch
|
||||
def apply(config) -> bool:
|
||||
def apply(config: Config, base: Dict[str, Any]) -> bool:
|
||||
attributes = [
|
||||
"paddingTop",
|
||||
"paddingBottom",
|
||||
@@ -36,9 +42,9 @@ def apply(config) -> bool:
|
||||
root = tree.getroot()
|
||||
|
||||
for attr in attributes:
|
||||
if config["verbose"]:
|
||||
if base.get("verbose", False):
|
||||
tqdm.write(f"set {attr} = 0.0dip")
|
||||
root.set(f"{{{config["xml_ns"]['android']}}}{attr}", "0.0dip")
|
||||
root.set(f"{{{base['xml_ns']['android']}}}{attr}", "0.0dip")
|
||||
|
||||
tree.write(
|
||||
beta_banner_xml, pretty_print=True, xml_declaration=True, encoding="utf-8"
|
||||
|
||||
Reference in New Issue
Block a user