From 4e6907647f6d8963b83cde6902da4f1dac17baf9 Mon Sep 17 00:00:00 2001 From: Dustin Pianalto Date: Thu, 10 May 2018 16:45:35 -0800 Subject: [PATCH] Create Guid Class --- exts/imports/guid.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exts/imports/guid.py b/exts/imports/guid.py index bfef4fd..f7f193e 100644 --- a/exts/imports/guid.py +++ b/exts/imports/guid.py @@ -14,7 +14,7 @@ class Guid: else: self.guid = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) - def get_guid(self, args) -> tuple: + def get_guid(self, args) -> None: s = Struct('i2h8B') if len(args) == 1 and isinstance(args[0], bytes) and len(args[0]) == 16: b = args[0] @@ -39,6 +39,8 @@ class Guid: b = pack('Q8x', id_int) elif all((self.bytes_needed(arg) <= 64) for arg in args): b = pack('QQ', args[0], args[1]) + else: + raise TypeError('Arguments don\'t match any allowed configuration') guid = s.pack((int(b[3]) << 24) | (int(b[2]) << 16) | (int(b[1]) << 8) | b[0], ((int(b[5]) << 8) | b[4]), (int(b[7]) << 8) | b[6],