Reverse previous indentation changes to legacy uuid support and instead alter the definition of generate_uuid accordingly
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/cdee0545 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/cdee0545 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/cdee0545 Branch: refs/heads/master Commit: cdee05455979b9f6fd5f31d4842d75e2ff5f3a94 Parents: 5479532 Author: Gordon Sim <[email protected]> Authored: Fri Feb 6 09:46:01 2015 +0000 Committer: Gordon Sim <[email protected]> Committed: Fri Feb 6 09:46:01 2015 +0000 ---------------------------------------------------------------------- proton-c/bindings/python/proton/__init__.py | 36 +++++++++++++----------- 1 file changed, 20 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cdee0545/proton-c/bindings/python/proton/__init__.py ---------------------------------------------------------------------- diff --git a/proton-c/bindings/python/proton/__init__.py b/proton-c/bindings/python/proton/__init__.py index 4f17eb0..58c442d 100644 --- a/proton-c/bindings/python/proton/__init__.py +++ b/proton-c/bindings/python/proton/__init__.py @@ -36,6 +36,10 @@ from wrapper import Wrapper import weakref, socket, sys try: import uuid + + def generate_uuid(): + return uuid.uuid4() + except ImportError: """ No 'native' UUID support. Provide a very basic UUID type that is a compatible subset of the uuid type provided by more modern python releases. @@ -68,26 +72,26 @@ except ImportError: def __hash__(self): return self.bytes.__hash__() - import os, random, time - rand = random.Random() - rand.seed((os.getpid(), time.time(), socket.gethostname())) - def random_uuid(): - bytes = [rand.randint(0, 255) for i in xrange(16)] + import os, random, time + rand = random.Random() + rand.seed((os.getpid(), time.time(), socket.gethostname())) + def random_uuid(): + bytes = [rand.randint(0, 255) for i in xrange(16)] - # From RFC4122, the version bits are set to 0100 - bytes[7] &= 0x0F - bytes[7] |= 0x40 + # From RFC4122, the version bits are set to 0100 + bytes[7] &= 0x0F + bytes[7] |= 0x40 - # From RFC4122, the top two bits of byte 8 get set to 01 - bytes[8] &= 0x3F - bytes[8] |= 0x80 - return "".join(map(chr, bytes)) + # From RFC4122, the top two bits of byte 8 get set to 01 + bytes[8] &= 0x3F + bytes[8] |= 0x80 + return "".join(map(chr, bytes)) - def uuid4(): - return uuid.UUID(bytes=random_uuid()) + def uuid4(): + return uuid.UUID(bytes=random_uuid()) -def generate_uuid(): - return uuid.uuid4() + def generate_uuid(): + return uuid4() try: bytes() --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
