Skip to content

Commit 7370756

Browse files
BarbossHackgreyson-signal
authored andcommitted
Fix type and type annotations issues in reproducible script.
Resolves #14573
1 parent 7894377 commit 7370756

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

reproducible-builds/apkdiff/apkdiff.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@ def compare_android_xml(bytes1: bytes, bytes2: bytes) -> bool:
134134
bad_differences = []
135135

136136
for diff in all_differences:
137-
is_split_attr = diff.diff_type == "attribute" and diff.path in ["manifest", "manifest/application"] and "split" in diff.attribute_name.lower()
137+
is_split_attr = diff.diff_type == "attribute" and diff.path in ["manifest", "manifest/application"] and diff.attribute_name is not None and "split" in diff.attribute_name.lower()
138138
is_meta_attr = diff.diff_type == "attribute" and diff.path == "manifest/application/meta-data"
139139
is_meta_child_count = diff.diff_type == "child_count" and diff.child_tag == "meta-data"
140140

141-
if not is_split_attr and not is_meta_attr and not is_meta_child_count and not is_meta_attr:
141+
if not is_split_attr and not is_meta_attr and not is_meta_child_count:
142142
bad_differences.append(diff)
143143

144144
if bad_differences:
@@ -286,7 +286,7 @@ def compare_xml(bytes1: bytes, bytes2: bytes) -> list[XmlDifference]:
286286
entry_text_2 = printer.get_xml().decode("utf-8")
287287

288288
if entry_text_1 == entry_text_2:
289-
return True
289+
return []
290290

291291
root1 = ET.fromstring(entry_text_1)
292292
root2 = ET.fromstring(entry_text_2)
@@ -329,11 +329,11 @@ def compare_xml_elements(elem1: Element, elem2: Element, path: str = "") -> list
329329
children2 = list(elem2)
330330

331331
# Try to match children by tag name for comparison
332-
children1_by_tag = {}
332+
children1_by_tag: dict[str, list[Element]] = {}
333333
for child in children1:
334334
children1_by_tag.setdefault(child.tag, []).append(child)
335335

336-
children2_by_tag = {}
336+
children2_by_tag: dict[str, list[Element]] = {}
337337
for child in children2:
338338
children2_by_tag.setdefault(child.tag, []).append(child)
339339

0 commit comments

Comments
 (0)