Python 3 compatibility: fix xrange/range issues

xrange is not defined in python3.
Rename xrange() to range().

Story: 2003430

Task: 25738

Change-Id: I267864d9b0ff9134fadc0864bee7f9d7095eb621
Signed-off-by: zhangyangyang <zhangyangyang@unionpay.com>
This commit is contained in:
zhangyangyang 2018-09-01 17:28:14 +08:00
parent 41a543c346
commit 321b24eb7e

View File

@ -232,13 +232,13 @@ def trycmd(*args, **kwargs):
def generate_uid(topic, size=8):
characters = '01234567890abcdefghijklmnopqrstuvwxyz'
choices = [random.choice(characters) for _x in xrange(size)]
choices = [random.choice(characters) for _x in range(size)]
return '%s-%s' % (topic, ''.join(choices))
def random_alnum(size=32):
characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
return ''.join(random.choice(characters) for _ in xrange(size))
return ''.join(random.choice(characters) for _ in range(size))
class LazyPluggable(object):