gurudesh/pytracebugs huggingface dataset:
# Buggy code
def SetFilePath(self, file_path):
    """Sets the file-like object based on the file path.

    Args:
      file_path: the full path to the output file.
    """
    self._file_object = open(file_path, "wb")


# Traceback (MemoryError)
2015-10-14 12:58:53,921 [WARNING] (StorageWriter) PID:2384 <multi_process> Unhandled exception in storage writer (PID: 2384).
2015-10-14 12:58:53,926 [ERROR] (StorageWriter) PID:2384 <multi_process>
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/plaso/multi_processing/multi_process.py", line 1184, in _Main
self._storage_writer.WriteEventObjects()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 1645, in WriteEventObjects
self._Close()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 1675, in _Close
self._storage_file.Close()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 874, in Close
self._FlushBuffer()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 431, in _FlushBuffer
self._WriteStream(stream_name, b''.join(proto_str))
MemoryError
2015-10-14 12:59:17,026 [WARNING] (MainProcess) PID:2379 <multi_process> Killing process: Worker_00 (PID: 2385).
2015-10-14 12:59:17,026 [WARNING] (MainProcess) PID:2379 <multi_process> Killing process: Worker_04 (PID: 2392).
Processing completed with errors.

# Fixed code
def SetFilePath(self, file_path):
    """Sets the file-like object based on the file path.

    Args:
      file_path: the full path to the output file.
    """
    self._file_path = file_path
# Buggy code
def WriteEventBody(self, event_object):
    """Writes the body of an event object to the output.

    Args:
      event_object: the event object (instance of EventObject).
    """
    # Needed due to duplicate removals, if two events
    # are merged then we'll just pick the first inode value.
    inode = getattr(event_object, "inode", None)
    if isinstance(inode, basestring):
        inode_list = inode.split(";")
        try:
            new_inode = int(inode_list[0])
        except (ValueError, IndexError):
            new_inode = 0

        event_object.inode = new_inode

    self._storage.AddEventObject(event_object)


# Traceback (MemoryError)
2015-10-14 12:58:53,921 [WARNING] (StorageWriter) PID:2384 <multi_process> Unhandled exception in storage writer (PID: 2384).
2015-10-14 12:58:53,926 [ERROR] (StorageWriter) PID:2384 <multi_process>
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/plaso/multi_processing/multi_process.py", line 1184, in _Main
self._storage_writer.WriteEventObjects()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 1645, in WriteEventObjects
self._Close()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 1675, in _Close
self._storage_file.Close()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 874, in Close
self._FlushBuffer()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 431, in _FlushBuffer
self._WriteStream(stream_name, b''.join(proto_str))
MemoryError
2015-10-14 12:59:17,026 [WARNING] (MainProcess) PID:2379 <multi_process> Killing process: Worker_00 (PID: 2385).
2015-10-14 12:59:17,026 [WARNING] (MainProcess) PID:2379 <multi_process> Killing process: Worker_04 (PID: 2392).
Processing completed with errors.

# Fixed code
def WriteEventBody(self, event_object):
    """Writes the body of an event object to the output.

    Args:
      event_object: the event object (instance of EventObject).
    """
    # Needed due to duplicate removals, if two events
    # are merged then we'll just pick the first inode value.
    inode = getattr(event_object, "inode", None)
    if isinstance(inode, basestring):
        inode_list = inode.split(";")
        try:
            new_inode = int(inode_list[0])
        except (ValueError, IndexError):
            new_inode = 0

        event_object.inode = new_inode

    self._storage_file.AddEventObject(event_object)
# Buggy code
def __init__(self, zip_file, stream_name):
    """Initializes a serialized data stream object.

    Args:
      zip_file: the ZIP file object that contains the stream.
      stream_name: string containing the name of the stream.
    """
    super(_SerializedDataStream, self).__init__()
    self._entry_index = 0
    self._file_object = None
    self._stream_name = stream_name
    self._stream_offset = 0
    self._zip_file = zip_file


# Traceback (MemoryError)
2015-10-14 12:58:53,921 [WARNING] (StorageWriter) PID:2384 <multi_process> Unhandled exception in storage writer (PID: 2384).
2015-10-14 12:58:53,926 [ERROR] (StorageWriter) PID:2384 <multi_process>
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/plaso/multi_processing/multi_process.py", line 1184, in _Main
self._storage_writer.WriteEventObjects()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 1645, in WriteEventObjects
self._Close()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 1675, in _Close
self._storage_file.Close()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 874, in Close
self._FlushBuffer()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 431, in _FlushBuffer
self._WriteStream(stream_name, b''.join(proto_str))
MemoryError
2015-10-14 12:59:17,026 [WARNING] (MainProcess) PID:2379 <multi_process> Killing process: Worker_00 (PID: 2385).
2015-10-14 12:59:17,026 [WARNING] (MainProcess) PID:2379 <multi_process> Killing process: Worker_04 (PID: 2392).
Processing completed with errors.

# Fixed code
def __init__(self, zip_file, storage_file_path, stream_name):
    """Initializes a serialized data stream object.

    Args:
      zip_file: the ZIP file object that contains the stream.
      storage_file_path: string containing the path of the storage file.
      stream_name: string containing the name of the stream.
    """
    super(_SerializedDataStream, self).__init__()
    self._entry_index = 0
    self._file_object = None
    self._path = os.path.dirname(os.path.abspath(storage_file_path))
    self._stream_name = stream_name
    self._stream_offset = 0
    self._zip_file = zip_file
# Buggy code
def WriteFinalize(self):
    """Finalize the write of a serialized data stream.

    Writes the temporary file with the serialized data to the zip file.

    Returns:
      An integer containing the offset of the temporary file.

    Raises:
      IOError: if the serialized data stream cannot be written.
    """
    offset = self._file_object.tell()
    self._file_object.close()
    self._file_object = None

    try:
        self._zip_file.write(self._stream_name)
    finally:
        os.remove(self._stream_name)

    return offset


# Traceback (MemoryError)
2015-10-14 12:58:53,921 [WARNING] (StorageWriter) PID:2384 <multi_process> Unhandled exception in storage writer (PID: 2384).
2015-10-14 12:58:53,926 [ERROR] (StorageWriter) PID:2384 <multi_process>
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/plaso/multi_processing/multi_process.py", line 1184, in _Main
self._storage_writer.WriteEventObjects()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 1645, in WriteEventObjects
self._Close()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 1675, in _Close
self._storage_file.Close()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 874, in Close
self._FlushBuffer()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 431, in _FlushBuffer
self._WriteStream(stream_name, b''.join(proto_str))
MemoryError
2015-10-14 12:59:17,026 [WARNING] (MainProcess) PID:2379 <multi_process> Killing process: Worker_00 (PID: 2385).
2015-10-14 12:59:17,026 [WARNING] (MainProcess) PID:2379 <multi_process> Killing process: Worker_04 (PID: 2392).
Processing completed with errors.

# Fixed code
def WriteFinalize(self):
    """Finalize the write of a serialized data stream.

    Writes the temporary file with the serialized data to the zip file.

    Returns:
      An integer containing the offset of the temporary file.

    Raises:
      IOError: if the serialized data stream cannot be written.
    """
    offset = self._file_object.tell()
    self._file_object.close()
    self._file_object = None

    current_working_directory = os.getcwd()
    try:
        os.chdir(self._path)
        self._zip_file.write(self._stream_name)
    finally:
        os.remove(self._stream_name)
        os.chdir(current_working_directory)

    return offset
# Buggy code
def WriteInitialize(self):
    """Initializes the write of a serialized data stream.

    Creates a temporary file to store the serialized data.

    Returns:
      An integer containing the offset of the temporary file.

    Raises:
      IOError: if the serialized data stream cannot be written.
    """
    self._file_object = open(self._stream_name, "wb")
    return self._file_object.tell()


# Traceback (MemoryError)
2015-10-14 12:58:53,921 [WARNING] (StorageWriter) PID:2384 <multi_process> Unhandled exception in storage writer (PID: 2384).
2015-10-14 12:58:53,926 [ERROR] (StorageWriter) PID:2384 <multi_process>
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/plaso/multi_processing/multi_process.py", line 1184, in _Main
self._storage_writer.WriteEventObjects()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 1645, in WriteEventObjects
self._Close()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 1675, in _Close
self._storage_file.Close()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 874, in Close
self._FlushBuffer()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 431, in _FlushBuffer
self._WriteStream(stream_name, b''.join(proto_str))
MemoryError
2015-10-14 12:59:17,026 [WARNING] (MainProcess) PID:2379 <multi_process> Killing process: Worker_00 (PID: 2385).
2015-10-14 12:59:17,026 [WARNING] (MainProcess) PID:2379 <multi_process> Killing process: Worker_04 (PID: 2392).
Processing completed with errors.

# Fixed code
def WriteInitialize(self):
    """Initializes the write of a serialized data stream.

    Creates a temporary file to store the serialized data.

    Returns:
      An integer containing the offset of the temporary file.

    Raises:
      IOError: if the serialized data stream cannot be written.
    """
    stream_file_path = os.path.join(self._path, self._stream_name)
    self._file_object = open(stream_file_path, "wb")
    return self._file_object.tell()
# Buggy code
def __init__(self):
    """Initializes a ZIP-based storage file object."""
    super(ZIPStorageFile, self).__init__()
    self._event_object_streams = {}
    self._offset_tables = {}
    self._offset_tables_lfu = []
    self._timestamp_tables = {}
    self._timestamp_tables_lfu = []
    self._zipfile = None


# Traceback (MemoryError)
2015-10-14 12:58:53,921 [WARNING] (StorageWriter) PID:2384 <multi_process> Unhandled exception in storage writer (PID: 2384).
2015-10-14 12:58:53,926 [ERROR] (StorageWriter) PID:2384 <multi_process>
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/plaso/multi_processing/multi_process.py", line 1184, in _Main
self._storage_writer.WriteEventObjects()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 1645, in WriteEventObjects
self._Close()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 1675, in _Close
self._storage_file.Close()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 874, in Close
self._FlushBuffer()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 431, in _FlushBuffer
self._WriteStream(stream_name, b''.join(proto_str))
MemoryError
2015-10-14 12:59:17,026 [WARNING] (MainProcess) PID:2379 <multi_process> Killing process: Worker_00 (PID: 2385).
2015-10-14 12:59:17,026 [WARNING] (MainProcess) PID:2379 <multi_process> Killing process: Worker_04 (PID: 2392).
Processing completed with errors.

# Fixed code
def __init__(self):
    """Initializes a ZIP-based storage file object."""
    super(ZIPStorageFile, self).__init__()
    self._event_object_streams = {}
    self._offset_tables = {}
    self._offset_tables_lfu = []
    self._path = None
    self._timestamp_tables = {}
    self._timestamp_tables_lfu = []
    self._zipfile = None
# Buggy code
def _GetSerializedEventObjectStream(self, stream_number):
    """Retrieves the serialized event object stream.

    Args:
      stream_number: an integer containing the number of the stream.

    Returns:
      A serialized data stream object (instance of _SerializedDataStream).

    Raises:
      IOError: if the stream cannot be opened.
    """
    data_stream = self._event_object_streams.get(stream_number, None)
    if not data_stream:
        stream_name = "plaso_proto.{0:06d}".format(stream_number)
        if not self._HasStream(stream_name):
            raise IOError("No such stream: {0:s}".format(stream_name))

        data_stream = _SerializedDataStream(self._zipfile, stream_name)
        self._event_object_streams[stream_number] = data_stream

    return data_stream


# Traceback (MemoryError)
2015-10-14 12:58:53,921 [WARNING] (StorageWriter) PID:2384 <multi_process> Unhandled exception in storage writer (PID: 2384).
2015-10-14 12:58:53,926 [ERROR] (StorageWriter) PID:2384 <multi_process>
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/plaso/multi_processing/multi_process.py", line 1184, in _Main
self._storage_writer.WriteEventObjects()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 1645, in WriteEventObjects
self._Close()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 1675, in _Close
self._storage_file.Close()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 874, in Close
self._FlushBuffer()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 431, in _FlushBuffer
self._WriteStream(stream_name, b''.join(proto_str))
MemoryError
2015-10-14 12:59:17,026 [WARNING] (MainProcess) PID:2379 <multi_process> Killing process: Worker_00 (PID: 2385).
2015-10-14 12:59:17,026 [WARNING] (MainProcess) PID:2379 <multi_process> Killing process: Worker_04 (PID: 2392).
Processing completed with errors.

# Fixed code
def _GetSerializedEventObjectStream(self, stream_number):
    """Retrieves the serialized event object stream.

    Args:
      stream_number: an integer containing the number of the stream.

    Returns:
      A serialized data stream object (instance of _SerializedDataStream).

    Raises:
      IOError: if the stream cannot be opened.
    """
    data_stream = self._event_object_streams.get(stream_number, None)
    if not data_stream:
        stream_name = "plaso_proto.{0:06d}".format(stream_number)
        if not self._HasStream(stream_name):
            raise IOError("No such stream: {0:s}".format(stream_name))

        data_stream = _SerializedDataStream(self._zipfile, self._path, stream_name)
        self._event_object_streams[stream_number] = data_stream

    return data_stream
# Buggy code
def _Open(self, path, access_mode="r"):
    """Opens the storage file.

    Args:
      path: string containing the path of the storage file.
      access_mode: optional string indicating the access mode.

    Raises:
      IOError: if the ZIP file is already opened or if the ZIP file cannot
               be opened.
    """
    if self._zipfile:
        raise IOError("ZIP file already opened.")

    try:
        self._zipfile = zipfile.ZipFile(
            path, mode=access_mode, compression=zipfile.ZIP_DEFLATED, allowZip64=True
        )

    except zipfile.BadZipfile as exception:
        raise IOError("Unable to open ZIP file with error: {0:s}".format(exception))


# Traceback (MemoryError)
2015-10-14 12:58:53,921 [WARNING] (StorageWriter) PID:2384 <multi_process> Unhandled exception in storage writer (PID: 2384).
2015-10-14 12:58:53,926 [ERROR] (StorageWriter) PID:2384 <multi_process>
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/plaso/multi_processing/multi_process.py", line 1184, in _Main
self._storage_writer.WriteEventObjects()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 1645, in WriteEventObjects
self._Close()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 1675, in _Close
self._storage_file.Close()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 874, in Close
self._FlushBuffer()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 431, in _FlushBuffer
self._WriteStream(stream_name, b''.join(proto_str))
MemoryError
2015-10-14 12:59:17,026 [WARNING] (MainProcess) PID:2379 <multi_process> Killing process: Worker_00 (PID: 2385).
2015-10-14 12:59:17,026 [WARNING] (MainProcess) PID:2379 <multi_process> Killing process: Worker_04 (PID: 2392).
Processing completed with errors.

# Fixed code
def _Open(self, path, access_mode="r"):
    """Opens the storage file.

    Args:
      path: string containing the path of the storage file.
      access_mode: optional string indicating the access mode.

    Raises:
      IOError: if the ZIP file is already opened or if the ZIP file cannot
               be opened.
    """
    if self._zipfile:
        raise IOError("ZIP file already opened.")

    self._path = path

    try:
        self._zipfile = zipfile.ZipFile(
            self._path,
            mode=access_mode,
            compression=zipfile.ZIP_DEFLATED,
            allowZip64=True,
        )

    except zipfile.BadZipfile as exception:
        raise IOError("Unable to open ZIP file with error: {0:s}".format(exception))
# Buggy code
def _ReadEventTagByIdentifier(self, store_number, entry_index, uuid):
    """Reads an event tag by identifier.

    Args:
      store_number: the store number.
      entry_index: an integer containing the serialized data stream entry index.
      uuid: the UUID string.

    Returns:
      The event tag (instance of EventTag).

    Raises:
      IOError: if the event tag data stream cannot be opened.
    """
    tag_index_value = self._GetEventTagIndexValue(store_number, entry_index, uuid)
    if tag_index_value is None:
        return

    stream_name = "plaso_tagging.{0:06d}".format(tag_index_value.store_number)
    if not self._HasStream(stream_name):
        raise IOError("No such stream: {0:s}".format(stream_name))

    data_stream = _SerializedDataStream(self._zipfile, stream_name)
    data_stream.SeekEntryAtOffset(entry_index, tag_index_value.store_offset)
    return data_stream.ReadEntry()


# Traceback (MemoryError)
2015-10-14 12:58:53,921 [WARNING] (StorageWriter) PID:2384 <multi_process> Unhandled exception in storage writer (PID: 2384).
2015-10-14 12:58:53,926 [ERROR] (StorageWriter) PID:2384 <multi_process>
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/plaso/multi_processing/multi_process.py", line 1184, in _Main
self._storage_writer.WriteEventObjects()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 1645, in WriteEventObjects
self._Close()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 1675, in _Close
self._storage_file.Close()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 874, in Close
self._FlushBuffer()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 431, in _FlushBuffer
self._WriteStream(stream_name, b''.join(proto_str))
MemoryError
2015-10-14 12:59:17,026 [WARNING] (MainProcess) PID:2379 <multi_process> Killing process: Worker_00 (PID: 2385).
2015-10-14 12:59:17,026 [WARNING] (MainProcess) PID:2379 <multi_process> Killing process: Worker_04 (PID: 2392).
Processing completed with errors.

# Fixed code
def _ReadEventTagByIdentifier(self, store_number, entry_index, uuid):
    """Reads an event tag by identifier.

    Args:
      store_number: the store number.
      entry_index: an integer containing the serialized data stream entry index.
      uuid: the UUID string.

    Returns:
      The event tag (instance of EventTag).

    Raises:
      IOError: if the event tag data stream cannot be opened.
    """
    tag_index_value = self._GetEventTagIndexValue(store_number, entry_index, uuid)
    if tag_index_value is None:
        return

    stream_name = "plaso_tagging.{0:06d}".format(tag_index_value.store_number)
    if not self._HasStream(stream_name):
        raise IOError("No such stream: {0:s}".format(stream_name))

    data_stream = _SerializedDataStream(self._zipfile, self._path, stream_name)
    data_stream.SeekEntryAtOffset(entry_index, tag_index_value.store_offset)
    return data_stream.ReadEntry()
# Buggy code
def GetStorageInformation(self):
    """Retrieves storage (preprocessing) information stored in the storage file.

    Returns:
      A list of preprocessing objects (instances of PreprocessingObject)
      that contain the storage information.
    """
    stream_name = "information.dump"
    if not self._HasStream(stream_name):
        return []

    data_stream = _SerializedDataStream(self._zipfile, stream_name)

    information = []
    preprocess_object = self._ReadPreprocessObject(data_stream)
    while preprocess_object:
        information.append(preprocess_object)
        preprocess_object = self._ReadPreprocessObject(data_stream)

    stores = self._GetSerializedEventObjectStreamNumbers()
    information[-1].stores = {}
    information[-1].stores["Number"] = len(stores)
    for store_number in stores:
        store_identifier = "Store {0:d}".format(store_number)
        information[-1].stores[store_identifier] = self._ReadMeta(store_number)

    return information


# Traceback (MemoryError)
2015-10-14 12:58:53,921 [WARNING] (StorageWriter) PID:2384 <multi_process> Unhandled exception in storage writer (PID: 2384).
2015-10-14 12:58:53,926 [ERROR] (StorageWriter) PID:2384 <multi_process>
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/plaso/multi_processing/multi_process.py", line 1184, in _Main
self._storage_writer.WriteEventObjects()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 1645, in WriteEventObjects
self._Close()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 1675, in _Close
self._storage_file.Close()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 874, in Close
self._FlushBuffer()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 431, in _FlushBuffer
self._WriteStream(stream_name, b''.join(proto_str))
MemoryError
2015-10-14 12:59:17,026 [WARNING] (MainProcess) PID:2379 <multi_process> Killing process: Worker_00 (PID: 2385).
2015-10-14 12:59:17,026 [WARNING] (MainProcess) PID:2379 <multi_process> Killing process: Worker_04 (PID: 2392).
Processing completed with errors.

# Fixed code
def GetStorageInformation(self):
    """Retrieves storage (preprocessing) information stored in the storage file.

    Returns:
      A list of preprocessing objects (instances of PreprocessingObject)
      that contain the storage information.
    """
    stream_name = "information.dump"
    if not self._HasStream(stream_name):
        return []

    data_stream = _SerializedDataStream(self._zipfile, self._path, stream_name)

    information = []
    preprocess_object = self._ReadPreprocessObject(data_stream)
    while preprocess_object:
        information.append(preprocess_object)
        preprocess_object = self._ReadPreprocessObject(data_stream)

    stores = self._GetSerializedEventObjectStreamNumbers()
    information[-1].stores = {}
    information[-1].stores["Number"] = len(stores)
    for store_number in stores:
        store_identifier = "Store {0:d}".format(store_number)
        information[-1].stores[store_identifier] = self._ReadMeta(store_number)

    return information
# Buggy code
def GetTagging(self):
    """Retrieves the event tags.

    Yields:
      An event tag object (instance of EventTag).

    Raises:
      IOError: if the stream cannot be opened.
    """
    for stream_name in self._GetStreamNames():
        if not stream_name.startswith("plaso_tagging."):
            continue

        if not self._HasStream(stream_name):
            raise IOError("No such stream: {0:s}".format(stream_name))

        data_stream = _SerializedDataStream(self._zipfile, stream_name)

        event_tag = self._ReadEventTag(data_stream)
        while event_tag:
            yield event_tag
            event_tag = self._ReadEventTag(data_stream)


# Traceback (MemoryError)
2015-10-14 12:58:53,921 [WARNING] (StorageWriter) PID:2384 <multi_process> Unhandled exception in storage writer (PID: 2384).
2015-10-14 12:58:53,926 [ERROR] (StorageWriter) PID:2384 <multi_process>
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/plaso/multi_processing/multi_process.py", line 1184, in _Main
self._storage_writer.WriteEventObjects()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 1645, in WriteEventObjects
self._Close()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 1675, in _Close
self._storage_file.Close()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 874, in Close
self._FlushBuffer()
File "/usr/lib/python2.7/dist-packages/plaso/lib/storage.py", line 431, in _FlushBuffer
self._WriteStream(stream_name, b''.join(proto_str))
MemoryError
2015-10-14 12:59:17,026 [WARNING] (MainProcess) PID:2379 <multi_process> Killing process: Worker_00 (PID: 2385).
2015-10-14 12:59:17,026 [WARNING] (MainProcess) PID:2379 <multi_process> Killing process: Worker_04 (PID: 2392).
Processing completed with errors.

# Fixed code
def GetTagging(self):
    """Retrieves the event tags.

    Yields:
      An event tag object (instance of EventTag).

    Raises:
      IOError: if the stream cannot be opened.
    """
    for stream_name in self._GetStreamNames():
        if not stream_name.startswith("plaso_tagging."):
            continue

        if not self._HasStream(stream_name):
            raise IOError("No such stream: {0:s}".format(stream_name))

        data_stream = _SerializedDataStream(self._zipfile, self._path, stream_name)

        event_tag = self._ReadEventTag(data_stream)
        while event_tag:
            yield event_tag
            event_tag = self._ReadEventTag(data_stream)
# Buggy code
def __init__(self, row, to_account):
    """Build a Skype Event from a single row.

    Args:
      row: A row object (instance of sqlite3.Row) that contains the
           extracted data from a single row in the database.
      to_account: A string containing the accounts (excluding the
                  author) of the conversation.
    """
    # Note that pysqlite does not accept a Unicode string in row['string'] and
    # will raise "IndexError: Index must be int or string".

    super(SkypeChatEvent, self).__init__(
        row["timestamp"], "Chat from Skype", self.DATA_TYPE
    )

    self.title = row["title"]
    self.text = row["body_xml"]
    self.from_account = "{0:s} <{1:s}>".format(row["from_displayname"], row["author"])
    self.to_account = to_account


# Traceback (AttributeError)
Traceback (most recent call last):
File "plaso\engine\worker.py", line 684, in _ProcessPathSpec
File "plaso\engine\worker.py", line 636, in _ProcessFileEntry
File "plaso\engine\worker.py", line 555, in _ProcessDataStream
File "plaso\engine\worker.py", line 353, in _ParseFileEntryWithParser
File "plaso\parsers\interface.py", line 288, in Parse
File "plaso\parsers\sqlite.py", line 268, in ParseFileObject
File "plaso\parsers\plugins.py", line 88, in UpdateChainAndProcess
File "plaso\parsers\sqlite_plugins\interface.py", line 89, in Process
File "plaso\parsers\sqlite_plugins\interface.py", line 52, in GetEntries
File "plaso\parsers\sqlite_plugins\skype.py", line 299, in ParseSMS
AttributeError: 'NoneType' object has no attribute 'replace'

# Fixed code
def __init__(self, posix_time, from_displayname, author, to_account, title, body_xml):
    """Build a Skype Event from a single row.

    Args:
      posix_time: the POSIX time value, which contains the number of seconds
                  since January 1, 1970 00:00:00 UTC.
      from_displayname: a string containing the from display name.
      author: a string containing the author.
      to_account: a string containing the accounts (excluding the
                  author) of the conversation.
      title: a string containing the title.
      body_xml: a string containing the body XML.
    """
    super(SkypeChatEvent, self).__init__(posix_time, "Chat from Skype")
    self.from_account = "{0:s} <{1:s}>".format(from_displayname, author)
    self.text = body_xml
    self.title = title
    self.to_account = to_account
# Buggy code
def __init__(
    self, timestamp, usage, identifier, full_name, display_name, email, country
):
    """Initialize the event.

    Args:
      timestamp: The POSIX timestamp value.
      usage: A string containing the description string of the timestamp.
      identifier: The row identifier.
      full_name: A string containing the full name of the Skype account holder.
      display_name: A string containing the chosen display name of the account
                    holder.
      email: A string containing the registered email address of the account
             holder.
      country: A string containing the chosen home country of the account
               holder.
    """
    super(SkypeAccountEvent, self).__init__(timestamp, usage)

    self.offset = identifier
    self.username = "{0:s} <{1:s}>".format(full_name, display_name)
    self.display_name = display_name
    self.email = email
    self.country = country
    self.data_type = self.DATA_TYPE


# Traceback (AttributeError)
Traceback (most recent call last):
File "plaso\engine\worker.py", line 684, in _ProcessPathSpec
File "plaso\engine\worker.py", line 636, in _ProcessFileEntry
File "plaso\engine\worker.py", line 555, in _ProcessDataStream
File "plaso\engine\worker.py", line 353, in _ParseFileEntryWithParser
File "plaso\parsers\interface.py", line 288, in Parse
File "plaso\parsers\sqlite.py", line 268, in ParseFileObject
File "plaso\parsers\plugins.py", line 88, in UpdateChainAndProcess
File "plaso\parsers\sqlite_plugins\interface.py", line 89, in Process
File "plaso\parsers\sqlite_plugins\interface.py", line 52, in GetEntries
File "plaso\parsers\sqlite_plugins\skype.py", line 299, in ParseSMS
AttributeError: 'NoneType' object has no attribute 'replace'

# Fixed code
def __init__(
    self, posix_time, usage, identifier, full_name, display_name, email, country
):
    """Initialize the event.

    Args:
      posix_time: the POSIX time value, which contains the number of seconds
                  since January 1, 1970 00:00:00 UTC.
      usage: a string containing the description string of the timestamp.
      identifier: an integer containing the row identifier.
      full_name: a string containing the full name of the Skype account holder.
      display_name: a string containing the chosen display name of the account
                    holder.
      email: a string containing the registered email address of the account
             holder.
      country: a string containing the chosen home country of the account
               holder.
    """
    super(SkypeAccountEvent, self).__init__(posix_time, usage)
    self.country = country
    self.display_name = display_name
    self.email = email
    self.offset = identifier
    self.username = "{0:s} <{1:s}>".format(full_name, display_name)
# Buggy code
def __init__(self, row, dst_number):
    """Read the information related with the SMS.

    Args:
      row: row form the sql query.
        row['time_sms']: timestamp when the sms was send.
        row['dstnum_sms']: number which receives the sms.
        row['msg_sms']: text send to this sms.
      dst_number: phone number where the user send the sms.
    """
    # Note that pysqlite does not accept a Unicode string in row['string'] and
    # will raise "IndexError: Index must be int or string".

    super(SkypeSMSEvent, self).__init__(
        row["time_sms"], "SMS from Skype", self.DATA_TYPE
    )

    self.number = dst_number
    self.text = row["msg_sms"]


# Traceback (AttributeError)
Traceback (most recent call last):
File "plaso\engine\worker.py", line 684, in _ProcessPathSpec
File "plaso\engine\worker.py", line 636, in _ProcessFileEntry
File "plaso\engine\worker.py", line 555, in _ProcessDataStream
File "plaso\engine\worker.py", line 353, in _ParseFileEntryWithParser
File "plaso\parsers\interface.py", line 288, in Parse
File "plaso\parsers\sqlite.py", line 268, in ParseFileObject
File "plaso\parsers\plugins.py", line 88, in UpdateChainAndProcess
File "plaso\parsers\sqlite_plugins\interface.py", line 89, in Process
File "plaso\parsers\sqlite_plugins\interface.py", line 52, in GetEntries
File "plaso\parsers\sqlite_plugins\skype.py", line 299, in ParseSMS
AttributeError: 'NoneType' object has no attribute 'replace'

# Fixed code
def __init__(self, posix_time, phone_number, text):
    """Read the information related with the SMS.

    Args:
      posix_time: the POSIX time value, which contains the number of seconds
                  since January 1, 1970 00:00:00 UTC.
      phone_number: a string containing the phone number where the SMS was sent.
      text: a string containing the text (SMS body) that was sent.
    """
    super(SkypeSMSEvent, self).__init__(posix_time, "SMS from Skype")
    self.number = phone_number
    self.text = text
# Buggy code
def __init__(
    self, timestamp, call_type, user_start_call, source, destination, video_conference
):
    """Contains information if the call was cancelled, accepted or finished.

    Args:
      timestamp: the timestamp of the event.
      call_type: WAITING, STARTED, FINISHED.
      user_start_call: boolean, true indicates that the owner
                       account started the call.
      source: the account which started the call.
      destination: the account which gets the call.
      video_conference: boolean, if is true it was a videoconference.
    """

    super(SkypeCallEvent, self).__init__(timestamp, "Call from Skype", self.DATA_TYPE)

    self.call_type = call_type
    self.user_start_call = user_start_call
    self.src_call = source
    self.dst_call = destination
    self.video_conference = video_conference


# Traceback (AttributeError)
Traceback (most recent call last):
File "plaso\engine\worker.py", line 684, in _ProcessPathSpec
File "plaso\engine\worker.py", line 636, in _ProcessFileEntry
File "plaso\engine\worker.py", line 555, in _ProcessDataStream
File "plaso\engine\worker.py", line 353, in _ParseFileEntryWithParser
File "plaso\parsers\interface.py", line 288, in Parse
File "plaso\parsers\sqlite.py", line 268, in ParseFileObject
File "plaso\parsers\plugins.py", line 88, in UpdateChainAndProcess
File "plaso\parsers\sqlite_plugins\interface.py", line 89, in Process
File "plaso\parsers\sqlite_plugins\interface.py", line 52, in GetEntries
File "plaso\parsers\sqlite_plugins\skype.py", line 299, in ParseSMS
AttributeError: 'NoneType' object has no attribute 'replace'

# Fixed code
def __init__(
    self, posix_time, call_type, user_start_call, source, destination, video_conference
):
    """Contains information if the call was cancelled, accepted or finished.

    Args:
      posix_time: the POSIX time value, which contains the number of seconds
                  since January 1, 1970 00:00:00 UTC.
      call_type: a string containing the call type e.g. WAITING, STARTED,
                 FINISHED.
      user_start_call: a boolean which indicates that the owner account
                       started the call.
      source: a string containing the account which started the call.
      destination: a string containing the account which gets the call.
      video_conference: a boolean which indicates if the call was a video
                        conference.
    """

    super(SkypeCallEvent, self).__init__(posix_time, "Call from Skype")
    self.call_type = call_type
    self.dst_call = destination
    self.src_call = source
    self.user_start_call = user_start_call
    self.video_conference = video_conference
# Buggy code
def ParseChat(self, parser_mediator, row, query=None, **unused_kwargs):
    """Parses a chat message row.

    Args:
      parser_mediator: A parser mediator object (instance of ParserMediator).
      row: The row resulting from the query.
      query: Optional query string.
    """
    # Note that pysqlite does not accept a Unicode string in row['string'] and
    # will raise "IndexError: Index must be int or string".

    to_account = ""
    accounts = []
    participants = row["participants"].split(" ")
    for participant in participants:
        if participant != row["author"]:
            accounts.append(participant)
    to_account = ", ".join(accounts)

    if not to_account:
        if row["dialog_partner"]:
            to_account = row["dialog_partner"]
        else:
            to_account = "Unknown User"

    event_object = SkypeChatEvent(row, to_account)
    parser_mediator.ProduceEvent(event_object, query=query)


# Traceback (AttributeError)
Traceback (most recent call last):
File "plaso\engine\worker.py", line 684, in _ProcessPathSpec
File "plaso\engine\worker.py", line 636, in _ProcessFileEntry
File "plaso\engine\worker.py", line 555, in _ProcessDataStream
File "plaso\engine\worker.py", line 353, in _ParseFileEntryWithParser
File "plaso\parsers\interface.py", line 288, in Parse
File "plaso\parsers\sqlite.py", line 268, in ParseFileObject
File "plaso\parsers\plugins.py", line 88, in UpdateChainAndProcess
File "plaso\parsers\sqlite_plugins\interface.py", line 89, in Process
File "plaso\parsers\sqlite_plugins\interface.py", line 52, in GetEntries
File "plaso\parsers\sqlite_plugins\skype.py", line 299, in ParseSMS
AttributeError: 'NoneType' object has no attribute 'replace'

# Fixed code
def ParseChat(self, parser_mediator, row, query=None, **unused_kwargs):
    """Parses a chat message row.

    Args:
      parser_mediator: A parser mediator object (instance of ParserMediator).
      row: The row resulting from the query.
      query: Optional query string.
    """
    # Note that pysqlite does not accept a Unicode string in row['string'] and
    # will raise "IndexError: Index must be int or string".

    to_account = ""
    accounts = []
    participants = row["participants"].split(" ")
    for participant in participants:
        if participant != row["author"]:
            accounts.append(participant)
    to_account = ", ".join(accounts)

    if not to_account:
        if row["dialog_partner"]:
            to_account = row["dialog_partner"]
        else:
            to_account = "Unknown User"

    event_object = SkypeChatEvent(
        row["timestamp"],
        row["from_displayname"],
        row["author"],
        to_account,
        row["title"],
        row["body_xml"],
    )
    parser_mediator.ProduceEvent(event_object, query=query)
# Buggy code
def ParseSMS(self, parser_mediator, row, query=None, **unused_kwargs):
    """Parse SMS.

    Args:
      parser_mediator: A parser mediator object (instance of ParserMediator).
      row: The row resulting from the query.
      query: Optional query string.
    """
    # Note that pysqlite does not accept a Unicode string in row['string'] and
    # will raise "IndexError: Index must be int or string".

    dst_number = row["dstnum_sms"].replace(" ", "")

    event_object = SkypeSMSEvent(row, dst_number)
    parser_mediator.ProduceEvent(event_object, query=query)


# Traceback (AttributeError)
Traceback (most recent call last):
File "plaso\engine\worker.py", line 684, in _ProcessPathSpec
File "plaso\engine\worker.py", line 636, in _ProcessFileEntry
File "plaso\engine\worker.py", line 555, in _ProcessDataStream
File "plaso\engine\worker.py", line 353, in _ParseFileEntryWithParser
File "plaso\parsers\interface.py", line 288, in Parse
File "plaso\parsers\sqlite.py", line 268, in ParseFileObject
File "plaso\parsers\plugins.py", line 88, in UpdateChainAndProcess
File "plaso\parsers\sqlite_plugins\interface.py", line 89, in Process
File "plaso\parsers\sqlite_plugins\interface.py", line 52, in GetEntries
File "plaso\parsers\sqlite_plugins\skype.py", line 299, in ParseSMS
AttributeError: 'NoneType' object has no attribute 'replace'

# Fixed code
def ParseSMS(self, parser_mediator, row, query=None, **unused_kwargs):
    """Parse SMS.

    Args:
      parser_mediator: A parser mediator object (instance of ParserMediator).
      row: The row resulting from the query.
      query: Optional query string.
    """
    # Note that pysqlite does not accept a Unicode string in row['string'] and
    # will raise "IndexError: Index must be int or string".

    phone_number = row["dstnum_sms"]
    if phone_number:
        phone_number = phone_number.replace(" ", "")

    event_object = SkypeSMSEvent(row["time_sms"], phone_number, row["msg_sms"])
    parser_mediator.ProduceEvent(event_object, query=query)
# Buggy code
def GetRootKey(self):
    """Retrieves the root keys.

    Yields:
      A Registry key (instance of WinRegistryKey).
    """
    regf_key = self._regf_file.get_root_key()
    return WinPyregfKey(regf_key, "", root=True)


# Traceback (AttributeError)
2015-08-26 10:45:34,469 [WARNING] (Worker_04 ) PID:21019 <worker> Unhandled exception while processing path spec: type: OS, location: <PATH>/test.dd
type: VHDI
type: TSK_PARTITION, location: /p1, part index: 2, start offset: 0x00007e00
type: TSK, inode: 377, location: /Documents and Settings/NetworkService/ntuser.dat.LOG
.
2015-08-26 10:45:34,470 [ERROR] (Worker_04 ) PID:21019 <worker> 'NoneType' object has no attribute 'values'
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/engine/worker.py", line 471, in _ProcessPathSpec
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/engine/worker.py", line 430, in _ProcessFileEntry
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/engine/worker.py", line 213, in _ParseFileEntryWithParser
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/parsers/interface.py", line 72, in UpdateChainAndParse
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/parsers/winreg.py", line 318, in Parse
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/parsers/winreg.py", line 264, in _ParseRegistryFile
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/parsers/plugins.py", line 85, in UpdateChainAndProcess
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/parsers/winreg_plugins/mrulist.py", line 192, in Process
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/parsers/winreg_plugins/interface.py", line 211, in Process
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/dfwinreg/regf.py", line 166, in GetValues
AttributeError: 'NoneType' object has no attribute 'values'

# Fixed code
def GetRootKey(self):
    """Retrieves the root keys.

    Returns:
      A Registry key (instance of WinRegistryKey) or None if not available.
    """
    regf_key = self._regf_file.get_root_key()
    if not regf_key:
        return

    return WinPyregfKey(regf_key, "", root=True)
# Buggy code
def RecurseKeys(self):
    """Recurses the Registry file keys starting with the root key.

    Yields:
      A Registry key (instance of WinPyregfKey) generator.
    """
    root_key = self.GetRootKey()
    return self._RecurseKey(root_key)


# Traceback (AttributeError)
2015-08-26 10:45:34,469 [WARNING] (Worker_04 ) PID:21019 <worker> Unhandled exception while processing path spec: type: OS, location: <PATH>/test.dd
type: VHDI
type: TSK_PARTITION, location: /p1, part index: 2, start offset: 0x00007e00
type: TSK, inode: 377, location: /Documents and Settings/NetworkService/ntuser.dat.LOG
.
2015-08-26 10:45:34,470 [ERROR] (Worker_04 ) PID:21019 <worker> 'NoneType' object has no attribute 'values'
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/engine/worker.py", line 471, in _ProcessPathSpec
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/engine/worker.py", line 430, in _ProcessFileEntry
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/engine/worker.py", line 213, in _ParseFileEntryWithParser
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/parsers/interface.py", line 72, in UpdateChainAndParse
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/parsers/winreg.py", line 318, in Parse
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/parsers/winreg.py", line 264, in _ParseRegistryFile
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/parsers/plugins.py", line 85, in UpdateChainAndProcess
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/parsers/winreg_plugins/mrulist.py", line 192, in Process
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/parsers/winreg_plugins/interface.py", line 211, in Process
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/dfwinreg/regf.py", line 166, in GetValues
AttributeError: 'NoneType' object has no attribute 'values'

# Fixed code
def RecurseKeys(self):
    """Recurses the Registry file keys starting with the root key.

    Yields:
      A Registry key (instance of WinPyregfKey) generator.

    Raises:
      StopIteration: when there is no root key to signal the generator is empty.
    """
    root_key = self.GetRootKey()
    if not root_key:
        raise StopIteration

    for key in self._RecurseKey(root_key):
        yield key
# Buggy code
def GetRootKey(self):
    """Retrieves the root keys.

    Yields:
      A Registry key (instance of WinRegistryKey).
    """
    regf_key = self._regf_file.get_root_key()
    # TODO: refactor to WinRegistryKey, also remove parent key path or
    # use WinRegistry path.
    return WinPyregfKey(regf_key, "", root=True)


# Traceback (AttributeError)
2015-08-26 10:45:34,469 [WARNING] (Worker_04 ) PID:21019 <worker> Unhandled exception while processing path spec: type: OS, location: <PATH>/test.dd
type: VHDI
type: TSK_PARTITION, location: /p1, part index: 2, start offset: 0x00007e00
type: TSK, inode: 377, location: /Documents and Settings/NetworkService/ntuser.dat.LOG
.
2015-08-26 10:45:34,470 [ERROR] (Worker_04 ) PID:21019 <worker> 'NoneType' object has no attribute 'values'
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/engine/worker.py", line 471, in _ProcessPathSpec
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/engine/worker.py", line 430, in _ProcessFileEntry
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/engine/worker.py", line 213, in _ParseFileEntryWithParser
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/parsers/interface.py", line 72, in UpdateChainAndParse
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/parsers/winreg.py", line 318, in Parse
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/parsers/winreg.py", line 264, in _ParseRegistryFile
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/parsers/plugins.py", line 85, in UpdateChainAndProcess
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/parsers/winreg_plugins/mrulist.py", line 192, in Process
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/parsers/winreg_plugins/interface.py", line 211, in Process
File "/usr/local/lib/python2.7/dist-packages/plaso-1.3.1_20150826-py2.7.egg/plaso/dfwinreg/regf.py", line 166, in GetValues
AttributeError: 'NoneType' object has no attribute 'values'

# Fixed code
def GetRootKey(self):
    """Retrieves the root keys.

    Returns:
      A Registry key (instance of WinRegistryKey) or None if not available.
    """
    regf_key = self._regf_file.get_root_key()
    if not regf_key:
        return

    # TODO: refactor to WinRegistryKey, also remove parent key path or
    # use WinRegistry path.
    return WinPyregfKey(regf_key, "", root=True)