comparison mercurial/url.py @ 8150:bbc24c0753a0

util: use built-in set and frozenset This drops Python 2.3 compatibility.
author Martin Geisler <mg@lazybytes.net>
date Wed, 22 Apr 2009 00:55:32 +0200
parents 5ad99abfab79
children 32a2a1e244f1
comparison
equal deleted inserted replaced
8149:ddbee2d0d634 8150:bbc24c0753a0
82 >>> quotepath('abc def%') 82 >>> quotepath('abc def%')
83 'abc%20def%25' 83 'abc%20def%25'
84 ''' 84 '''
85 global _safeset, _hex 85 global _safeset, _hex
86 if _safeset is None: 86 if _safeset is None:
87 _safeset = util.set(_safe) 87 _safeset = set(_safe)
88 _hex = util.set('abcdefABCDEF0123456789') 88 _hex = set('abcdefABCDEF0123456789')
89 l = list(path) 89 l = list(path)
90 for i in xrange(len(l)): 90 for i in xrange(len(l)):
91 c = l[i] 91 c = l[i]
92 if c == '%' and i + 2 < len(l) and (l[i+1] in _hex and l[i+2] in _hex): 92 if c == '%' and i + 2 < len(l) and (l[i+1] in _hex and l[i+2] in _hex):
93 pass 93 pass