From 5901949da9c2d74c909611ad0e36a4e9b86fb98c Mon Sep 17 00:00:00 2001 From: Ian Ross Date: Mon, 15 Nov 2021 21:19:16 +0100 Subject: [PATCH] Make Python behavior consistent with other versions - Make capabilities into a simple list: `TokenBuilder.with_capability` now just appends a value to the list, instead of using a set to make capability values unique. - Make applied tags into a simple list: same behavior for `TokenBuilder.apply_tag` as for the capabilities list. --- python/edgeauth/token_builder.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/python/edgeauth/token_builder.py b/python/edgeauth/token_builder.py index ea546f1..af9ce9e 100644 --- a/python/edgeauth/token_builder.py +++ b/python/edgeauth/token_builder.py @@ -66,11 +66,11 @@ def with_capability(self, capability): raise TypeError('Capability must be a string') token = self.token - capabilities = set(token['capabilities']) if 'capabilities' in token else set([]) + capabilities = token['capabilities'] if 'capabilities' in token else [] - capabilities.add(capability) + capabilities.append(capability) - self.token['capabilities'] = sorted(list(capabilities)) + self.token['capabilities'] = capabilities return self @@ -237,11 +237,11 @@ def apply_tag(self, tag): raise TypeError('Tag must be a string') token = self.token - apply_tags = set(token['applyTags']) if 'applyTags' in token else set() + apply_tags = token['applyTags'] if 'applyTags' in token else [] - apply_tags.add(tag) + apply_tags.append(tag) - self.token['applyTags'] = list(apply_tags) + self.token['applyTags'] = apply_tags return self