diff --git a/vrtManager/hostdetails.py b/vrtManager/hostdetails.py index 09c894f..f2defa3 100644 --- a/vrtManager/hostdetails.py +++ b/vrtManager/hostdetails.py @@ -18,7 +18,7 @@ class wvmHostDetails(wvmConnect): """ all_mem = self.wvm.getInfo()[1] * 1048576 freemem = self.wvm.getMemoryStats(-1, 0) - if isinstance(dict, freemem): + if isinstance(freemem, dict): free = (freemem['buffers'] + freemem['free'] + freemem['cached']) * 1024 @@ -36,7 +36,7 @@ class wvmHostDetails(wvmConnect): prev_idle = 0 prev_total = 0 cpu = self.wvm.getCPUStats(-1, 0) - if isinstance(dict, cpu): + if isinstance(cpu, dict): for num in range(2): idle = self.wvm.getCPUStats(-1, 0)['idle'] total = sum(self.wvm.getCPUStats(-1, 0).values()) diff --git a/vrtManager/util.py b/vrtManager/util.py index 9299e21..7c9a08e 100644 --- a/vrtManager/util.py +++ b/vrtManager/util.py @@ -26,7 +26,6 @@ def randomMAC(): def randomUUID(): """Generate a random UUID.""" - u = [random.randint(0, 255) for ignore in range(0, 16)] u[6] = (u[6] & 0x0F) | (4 << 4) u[8] = (u[8] & 0x3F) | (2 << 6) @@ -108,7 +107,7 @@ def get_xpath(doc, path): ret = doc.xpath(path) if ret is not None: - if isinstance(list, ret): + if isinstance(ret, list): if len(ret) >= 1: if hasattr(ret[0], 'text'): result = ret[0].text @@ -137,11 +136,10 @@ def pretty_bytes(val): def validate_uuid(val): - if not isinstance(str, val): + if not isinstance(val, str): raise ValueError("UUID must be a string.") - form = re.match("[a-fA-F0-9]{8}[-]([a-fA-F0-9]{4}[-]){3}[a-fA-F0-9]{12}$", - val) + form = re.match("[a-fA-F0-9]{8}[-]([a-fA-F0-9]{4}[-]){3}[a-fA-F0-9]{12}$", val) if form is None: form = re.match("[a-fA-F0-9]{32}$", val) if form is None: