# Buggy code
def _ProcessFileEntryDataStream(self, parser_mediator, file_entry, data_stream_name):
    """Processes a specific data stream of a file entry.

    Args:
      parser_mediator (ParserMediator): parser mediator.
      file_entry (dfvfs.FileEntry): file entry containing the data stream.
      data_stream_name (str): data stream name.
    """
    # Not every file entry has a data stream. In such cases we want to
    # extract the metadata only.
    has_data_stream = file_entry.HasDataStream(data_stream_name)
    if has_data_stream:
        self._HashDataStream(parser_mediator, file_entry, data_stream_name)

    # We always want to extract the file entry metadata but we only want
    # to parse it once per file entry, so we only use it if we are
    # processing the default (nameless) data stream.
    if not data_stream_name and (
        not file_entry.IsRoot()
        or file_entry.type_indicator in self._TYPES_WITH_ROOT_METADATA
    ):
        self._ExtractMetadataFromFileEntry(parser_mediator, file_entry)

    # Determine if the content of the file entry should not be extracted.
    skip_content_extraction = self._CanSkipContentExtraction(file_entry)
    if skip_content_extraction:
        display_name = parser_mediator.GetDisplayName()
        logging.info("Skipping content extraction of: {0:s}".format(display_name))
        return

    if not has_data_stream:
        if file_entry.IsDirectory():
            self._ProcessDirectory(parser_mediator, file_entry)

    else:
        path_spec = copy.deepcopy(file_entry.path_spec)
        path_spec.data_stream = data_stream_name

        archive_types = []
        compressed_stream_types = []

        compressed_stream_types = self._GetCompressedStreamTypes(
            parser_mediator, path_spec
        )

        if not compressed_stream_types:
            archive_types = self._GetArchiveTypes(parser_mediator, path_spec)

        if archive_types:
            if self._process_archive_files:
                self._ProcessArchiveTypes(parser_mediator, path_spec, archive_types)

            if dfvfs_definitions.TYPE_INDICATOR_ZIP in archive_types:
                self.processing_status = definitions.PROCESSING_STATUS_EXTRACTING

                # ZIP files are the base of certain file formats like docx.
                self._event_extractor.ParseDataStream(
                    parser_mediator, file_entry, data_stream_name
                )

        elif compressed_stream_types:
            self._ProcessCompressedStreamTypes(
                parser_mediator, path_spec, compressed_stream_types
            )

        else:
            self.processing_status = definitions.PROCESSING_STATUS_EXTRACTING

            self._event_extractor.ParseDataStream(
                parser_mediator, file_entry, data_stream_name
            )


# Traceback (ValueError)
(plaso) G:\test_data\iMessage>python C:\dev\plaso\tools\log2timeline.py set_1_output2.zip Set_1 -d
Checking availability and versions of plaso dependencies.
[OK]


Source path     : G:\test_data\iMessage\Set_1
Source type     : directory

Processing started.
2016-07-15 10:21:13,989 [DEBUG] (MainProcess) PID:10848 <extraction_frontend> Starting preprocessing.
2016-07-15 10:21:13,999 [DEBUG] (MainProcess) PID:10848 <extraction_frontend> Preprocessing done.
2016-07-15 10:21:14,006 [DEBUG] (MainProcess) PID:10848 <extraction_frontend> Starting extraction in multi process mode.

2016-07-15 10:21:14,019 [DEBUG] (MainProcess) PID:10848 <zeromq_queue> Task queue bound to random port 64564
2016-07-15 10:21:14,026 [DEBUG] (MainProcess) PID:10848 <zeromq_queue> ZeroMQ responder thread started
2016-07-15 10:21:27,663 [DEBUG] (MainProcess) PID:10848 <zip_file> Writing to ZIP file with buffer size: 205520896
2016-07-15 10:21:27,676 [DEBUG] (MainProcess) PID:10848 <engine> Task scheduler started
Worker_00 (PID: 8660) - events extracted: 18 - file: OS:G:\test_data\iMessage\Set_1\Applications\AACredentialRecoveryDia
log.app - running: True
Worker_01 (PID: 12736) - events extracted: 12 - file: OS:G:\test_data\iMessage\Set_1\.fseventsd\000000000024e0d9 - runni
ng: True
Worker_02 (PID: 11596) - events extracted: 21 - file: OS:G:\test_data\iMessage\Set_1\Applications\AdSheet.app - running:
True
Worker_03 (PID: 6796) - events extracted: 12 - file: OS:G:\test_data\iMessage\Set_1\.fseventsd\000000000008e006 - runnin
g: True
Worker_04 (PID: 6776) - events extracted: 12 - file: OS:G:\test_data\iMessage\Set_1\.fseventsd\0000000000232623 - runnin
g: True
Worker_05 (PID: 11408) - events extracted: 15 - file: OS:G:\test_data\iMessage\Set_1\.fseventsd\fseventsd-uuid - running
: True
Worker_06 (PID: 11156) - events extracted: 18 - file: OS:G:\test_data\iMessage\Set_1\Applications\AccountAuthenticationD
ialog.app - running: True
Traceback (most recent call last):
File "C:\dev\plaso\tools\log2timeline.py", line 803, in <module>
if not Main():
File "C:\dev\plaso\tools\log2timeline.py", line 789, in Main
tool.ProcessSources()
File "C:\dev\plaso\tools\log2timeline.py", line 699, in ProcessSources
timezone=self._timezone)
File "C:\dev\plaso\plaso\frontend\extraction_frontend.py", line 539, in ProcessSources
text_prepend=self._text_prepend)
File "C:\dev\plaso\plaso\multi_processing\engine.py", line 971, in ProcessSources
filter_find_specs=filter_find_specs)
File "C:\dev\plaso\plaso\multi_processing\engine.py", line 350, in _ProcessSources
self._ScheduleTasks(storage_writer)
File "C:\dev\plaso\plaso\multi_processing\engine.py", line 505, in _ScheduleTasks
if storage_writer.MergeTaskStorage(task_identifier):
File "C:\dev\plaso\plaso\storage\zip_file.py", line 3344, in MergeTaskStorage
self.MergeFromStorage(storage_reader)
File "C:\dev\plaso\plaso\storage\interface.py", line 278, in MergeFromStorage
for event_source in storage_reader.GetEventSources():
File "C:\dev\plaso\plaso\storage\zip_file.py", line 2683, in GetEventSources
data_stream, u'event_source'):
File "C:\dev\plaso\plaso\storage\zip_file.py", line 1800, in _ReadAttributeContainersFromStream
data_stream, container_type)
File "C:\dev\plaso\plaso\storage\zip_file.py", line 1787, in _ReadAttributeContainerFromStreamEntry
return self._ReadAttributeContainer(entry_data, container_type)
File "C:\dev\plaso\plaso\storage\zip_file.py", line 1769, in _ReadAttributeContainer
attribute_container = self._serializer.ReadSerialized(container_data)
File "C:\dev\plaso\plaso\serializer\json_serializer.py", line 664, in ReadSerialized
return cls.ReadSerializedDict(json_dict)
File "C:\dev\plaso\plaso\serializer\json_serializer.py", line 679, in ReadSerializedDict
return cls._ConvertDictToObject(json_dict)
File "C:\dev\plaso\plaso\serializer\json_serializer.py", line 507, in _ConvertDictToObject
attribute_value = cls._ConvertDictToObject(attribute_value)
File "C:\dev\plaso\plaso\serializer\json_serializer.py", line 469, in _ConvertDictToObject
return cls._ConvertDictToPathSpec(json_dict)
File "C:\dev\plaso\plaso\serializer\json_serializer.py", line 595, in _ConvertDictToPathSpec
json_dict[u'parent'] = cls._ConvertDictToPathSpec(json_dict[u'parent'])
File "C:\dev\plaso\plaso\serializer\json_serializer.py", line 601, in _ConvertDictToPathSpec
type_indicator, **json_dict)
File "C:\dev\dfvfs\dfvfs\path\factory.py", line 108, in NewPathSpec
return path_spec_type(**kwargs)
File "C:\dev\dfvfs\dfvfs\path\os_path_spec.py", line 43, in __init__
super(OSPathSpec, self).__init__(location=location, parent=parent, **kwargs)
File "C:\dev\dfvfs\dfvfs\path\location_path_spec.py", line 27, in __init__
super(LocationPathSpec, self).__init__(parent=parent, **kwargs)
File "C:\dev\dfvfs\dfvfs\path\path_spec.py", line 29, in __init__
u', '.join(kwargs)))
ValueError: Unused keyword arguments: data_stream.

# Fixed code
def _ProcessFileEntryDataStream(self, parser_mediator, file_entry, data_stream_name):
    """Processes a specific data stream of a file entry.

    Args:
      parser_mediator (ParserMediator): parser mediator.
      file_entry (dfvfs.FileEntry): file entry containing the data stream.
      data_stream_name (str): data stream name.
    """
    # Not every file entry has a data stream. In such cases we want to
    # extract the metadata only.
    has_data_stream = file_entry.HasDataStream(data_stream_name)
    if has_data_stream:
        self._HashDataStream(parser_mediator, file_entry, data_stream_name)

    # We always want to extract the file entry metadata but we only want
    # to parse it once per file entry, so we only use it if we are
    # processing the default (nameless) data stream.
    if not data_stream_name and (
        not file_entry.IsRoot()
        or file_entry.type_indicator in self._TYPES_WITH_ROOT_METADATA
    ):
        self._ExtractMetadataFromFileEntry(parser_mediator, file_entry)

    # Determine if the content of the file entry should not be extracted.
    skip_content_extraction = self._CanSkipContentExtraction(file_entry)
    if skip_content_extraction:
        display_name = parser_mediator.GetDisplayName()
        logging.info("Skipping content extraction of: {0:s}".format(display_name))
        return

    if not has_data_stream:
        if file_entry.IsDirectory():
            self._ProcessDirectory(parser_mediator, file_entry)

    else:
        path_spec = copy.deepcopy(file_entry.path_spec)
        if data_stream_name:
            path_spec.data_stream = data_stream_name

        archive_types = []
        compressed_stream_types = []

        compressed_stream_types = self._GetCompressedStreamTypes(
            parser_mediator, path_spec
        )

        if not compressed_stream_types:
            archive_types = self._GetArchiveTypes(parser_mediator, path_spec)

        if archive_types:
            if self._process_archive_files:
                self._ProcessArchiveTypes(parser_mediator, path_spec, archive_types)

            if dfvfs_definitions.TYPE_INDICATOR_ZIP in archive_types:
                self.processing_status = definitions.PROCESSING_STATUS_EXTRACTING

                # ZIP files are the base of certain file formats like docx.
                self._event_extractor.ParseDataStream(
                    parser_mediator, file_entry, data_stream_name
                )

        elif compressed_stream_types:
            self._ProcessCompressedStreamTypes(
                parser_mediator, path_spec, compressed_stream_types
            )

        else:
            self.processing_status = definitions.PROCESSING_STATUS_EXTRACTING

            self._event_extractor.ParseDataStream(
                parser_mediator, file_entry, data_stream_name
            )