aboutsummaryrefslogtreecommitdiff
path: root/uritemplate/template.py
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2020-01-07 14:06:28 -0800
committerandroid-build-merger <android-build-merger@google.com>2020-01-07 14:06:28 -0800
commit5492dc4462f38ec23ff1cd58f66f8d19cd23f04b (patch)
tree6072009c262a4bd31720d0c97d20d3a5dbffbb0c /uritemplate/template.py
parentb7137cc2f5b626d8d644ccd8866c4dab837bbd99 (diff)
parenteab8cbc70cc7907afb0105d11ebf812aa99c11d0 (diff)
downloaduritemplates-5492dc4462f38ec23ff1cd58f66f8d19cd23f04b.tar.gz
Upgrade python/uritemplates to 3.0.1
am: eab8cbc70c Change-Id: Ib1cf1d8c27befad71731abd470cb3eb7e73044ed
Diffstat (limited to 'uritemplate/template.py')
-rw-r--r--uritemplate/template.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/uritemplate/template.py b/uritemplate/template.py
index c9d7c7e..0df0da6 100644
--- a/uritemplate/template.py
+++ b/uritemplate/template.py
@@ -16,9 +16,10 @@ What do you do?
"""
import re
+from uritemplate.orderedset import OrderedSet
from uritemplate.variable import URIVariable
-template_re = re.compile('{([^\}]+)}')
+template_re = re.compile('{([^}]+)}')
def _merge(var_dict, overrides):
@@ -71,9 +72,10 @@ class URITemplate(object):
URIVariable(m.groups()[0]) for m in template_re.finditer(self.uri)
]
#: A set of variable names in the URI.
- self.variable_names = set()
+ self.variable_names = OrderedSet()
for variable in self.variables:
- self.variable_names.update(variable.variable_names)
+ for name in variable.variable_names:
+ self.variable_names.add(name)
def __repr__(self):
return 'URITemplate("%s")' % self