From ea93542e9007eba1eb04a6f3da7f344596b9967e Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Wed, 9 Mar 2022 14:51:17 +0000 Subject: Switch signature_to_elements to use tuple Previously, it used a structured string of format :. 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 --- scripts/hiddenapi/signature_trie.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'scripts/hiddenapi/signature_trie.py') 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 -- cgit v1.2.3-59-g8ed1b