Core: Fix LGTM recommendations

This is mostly unused imports and unused variables.
This commit is contained in:
Mike Auty
2020-11-04 22:41:39 +00:00
parent 7c75018fc4
commit 0a655d76a8
29 changed files with 68 additions and 103 deletions
+3 -3
View File
@@ -151,9 +151,9 @@ class QemuSuspendLayer(segmented.NonLinearlySegmentedLayer):
layer_name = self._base_layer,
max_length = name_len)
index += name_len
instance_id = self.context.object(self._qemu_table_name + constants.BANG + 'unsigned long',
offset = index,
layer_name = self._base_layer)
# instance_id = self.context.object(self._qemu_table_name + constants.BANG + 'unsigned long',
# offset = index,
# layer_name = self._base_layer)
index += 4
version_id = self.context.object(self._qemu_table_name + constants.BANG + 'unsigned long',
offset = index,
+2 -3
View File
@@ -33,6 +33,7 @@ except ImportError:
vollog = logging.getLogger(__name__)
# TODO: Type-annotating the ResourceAccessor.open method is difficult because HTTPResponse is not actually an IO[Any] type
# fix this
@@ -155,9 +156,7 @@ class ResourceAccessor(object):
IMPORTED_MAGIC = True
# This is because python-magic and file provide a magic module
# Only file's python has magic.detect_from_fobj
except AttributeError:
pass
except:
except (AttributeError, IOError):
pass
if detected:
@@ -3,7 +3,7 @@
#
import re
from typing import Generator, List, Tuple, Union
from typing import Generator, List, Tuple
class MultiRegexp(object):
+4 -5
View File
@@ -49,7 +49,7 @@ class VmwareLayer(segmented.SegmentedLayer):
raise VmwareFormatException(self.name, "Wrong magic bytes for Vmware layer: {}".format(repr(magic)))
# TODO: Change certain structure sizes based on the version
version = magic[1] & 0xf
# version = magic[1] & 0xf
group_size = struct.calcsize(self.group_structure)
@@ -91,9 +91,9 @@ class VmwareLayer(segmented.SegmentedLayer):
if tags[("regionsCount", ())][1] == 0:
raise VmwareFormatException(self.name, "VMware VMEM is not split into regions")
for region in range(tags[("regionsCount", ())][1]):
offset = tags[("regionPPN", (region, ))][1] * self._page_size
mapped_offset = tags[("regionPageNum", (region, ))][1] * self._page_size
length = tags[("regionSize", (region, ))][1] * self._page_size
offset = tags[("regionPPN", (region,))][1] * self._page_size
mapped_offset = tags[("regionPageNum", (region,))][1] * self._page_size
length = tags[("regionSize", (region,))][1] * self._page_size
self._segments.append((offset, mapped_offset, length, length))
@property
@@ -111,7 +111,6 @@ class VmwareLayer(segmented.SegmentedLayer):
class VmwareStacker(interfaces.automagic.StackerLayerInterface):
stack_order = 20
@classmethod