python: Stop using xrange().
[cascardo/ovs.git] / python / ovs / ovsuuid.py
index 8da36c6..f2d48ea 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2009, 2010, 2011 Nicira Networks
+# Copyright (c) 2009, 2010, 2011 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 import re
 import uuid
 
+from six.moves import range
+
 from ovs.db import error
 import ovs.db.parser
 
 uuidRE = re.compile("^xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx$"
                     .replace('x', '[0-9a-fA-F]'))
 
+
 def zero():
     return uuid.UUID(int=0)
 
@@ -41,7 +44,7 @@ def from_json(json, symtab=None):
         if not uuidRE.match(s):
             raise error.Error("\"%s\" is not a valid UUID" % s, json)
         return uuid.UUID(s)
-    except error.Error, e:
+    except error.Error as e:
         if not symtab:
             raise e
         try:
@@ -51,7 +54,7 @@ def from_json(json, symtab=None):
             raise e
 
         if name not in symtab:
-            symtab[name] = uuid4()
+            symtab[name] = uuid.uuid4()
         return symtab[name]