summaryrefslogtreecommitdiff
path: root/scripts/hiddenapi/signature_trie.py
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2022-03-09 14:51:17 +0000
committer Paul Duffin <paulduffin@google.com> 2022-03-15 15:16:04 +0000
commitea93542e9007eba1eb04a6f3da7f344596b9967e (patch)
tree0649f3eda3f892b69a78c3959f98db0feda0fcec /scripts/hiddenapi/signature_trie.py
parent19255f1d9149324cc07c3b8e3910f486410dd5e8 (diff)
Switch signature_to_elements to use tuple
Previously, it used a structured string of format <type>:<value>. A tuple is more efficient and less prone to edge cases, such as when the value is a field signature which itself contains a ":". Bug: 202154151 Test: m out/soong/hiddenapi/hiddenapi-flags.csv atest --host signature_trie_test verify_overlaps_test pyformat -s 4 --force_quote_type double -i scripts/hiddenapi/signature_trie* /usr/bin/pylint --rcfile $ANDROID_BUILD_TOP/tools/repohooks/tools/pylintrc scripts/hiddenapi/signature_trie* Change-Id: I80abaff243d98aad325df1b5a655bba7f9d04e2c
Diffstat (limited to 'scripts/hiddenapi/signature_trie.py')
-rw-r--r--scripts/hiddenapi/signature_trie.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/hiddenapi/signature_trie.py b/scripts/hiddenapi/signature_trie.py
index 2b0973adb..5871834c2 100644
--- a/scripts/hiddenapi/signature_trie.py
+++ b/scripts/hiddenapi/signature_trie.py
@@ -156,16 +156,16 @@ class InteriorNode(Node):
# 3 - class:UnicodeScript
# 4 - member:of(I)Ljava/lang/Character$UnicodeScript;
return list(
- chain([f"package:{x}" for x in packages],
- [f"class:{x}" for x in classes],
- [f"member:{x}" for x in member],
- [f"wildcard:{x}" for x in wildcard]))
+ chain([("package", x) for x in packages],
+ [("class", x) for x in classes],
+ [("member", x) for x in member],
+ [("wildcard", x) for x in wildcard]))
# pylint: enable=line-too-long
@staticmethod
def split_element(element):
- element_type, element_value = element.split(":", 1)
+ element_type, element_value = element
return element_type, element_value
@staticmethod