(
        self,
        name: str,
        files: Sequence[AbstractInputFile],
    )
return ProtocolSource(
            directory=directory,
            main_file=directory / role_analysis.main_file.name,
            config=config_analysis.config,
            metadata=config_analysis.metadata,
            files=[ProtocolSourceFile(name=f.name, role=f.role) for f in all_files],
            labware_definitions=role_analysis.labware_definitions,
        )
Read a set of file-like objects to disk, returning a ProtocolSource.

        Arguments:
            name: Name of the directory to create and place files in.
            files: List of files. Do not attempt to reuse and file-like objects
                in this list once they've been passed to the ProtocolReader.

        Returns:
            A validated ProtocolSource.

        Raises:
            ProtocolFilesInvalidError: Input file list given to the reader
                could not be validated as a protocol.
Read a set of file-like objects to disk, returning a ProtocolSource.
Read a set of file - like objects to disk returning a ProtocolSource .
async def read(
        self,
        name: str,
        files: Sequence[AbstractInputFile],
    ) -> ProtocolSource:
        """Read a set of file-like objects to disk, returning a ProtocolSource.

        Arguments:
            name: Name of the directory to create and place files in.
            files: List of files. Do not attempt to reuse and file-like objects
                in this list once they've been passed to the ProtocolReader.

        Returns:
            A validated ProtocolSource.

        Raises:
            ProtocolFilesInvalidError: Input file list given to the reader
                could not be validated as a protocol.
        """
        directory = self._directory / name
        try:
            buffered_files = await self._file_reader_writer.read(files)
            role_analysis = self._role_analyzer.analyze(buffered_files)
            config_analysis = self._config_analyzer.analyze(role_analysis.main_file)
        except (FileReadError, RoleAnalysisError, ConfigAnalysisError) as e:
            raise ProtocolFilesInvalidError(str(e))

        # TODO(mc, 2021-12-07): add support for other files, like arbitrary data files
        all_files: List[RoleAnalysisFile] = [
            role_analysis.main_file,
            *role_analysis.labware_files,
        ]

        # TODO(mc, 2021-12-09): writing to disk is inappropriate for future
        # use cases where files are already on disk, like the opentrons CLI
        await self._file_reader_writer.write(directory=directory, files=all_files)

        return ProtocolSource(
            directory=directory,
            main_file=directory / role_analysis.main_file.name,
            config=config_analysis.config,
            metadata=config_analysis.metadata,
            files=[ProtocolSourceFile(name=f.name, role=f.role) for f in all_files],
            labware_definitions=role_analysis.labware_definitions,
        )
async def read ( self , name : str , files : Sequence [ AbstractInputFile ] , ) -> ProtocolSource : directory = self . _directory / name try : buffered_files = await self . _file_reader_writer . read ( files ) role_analysis = self . _role_analyzer . analyze ( buffered_files ) config_analysis = self . _config_analyzer . analyze ( role_analysis . main_file ) except ( FileReadError , RoleAnalysisError , ConfigAnalysisError ) as e : raise ProtocolFilesInvalidError ( str ( e ) ) # TODO(mc, 2021-12-07): add support for other files, like arbitrary data files all_files : List [ RoleAnalysisFile ] = [ role_analysis . main_file , * role_analysis . labware_files , ] # TODO(mc, 2021-12-09): writing to disk is inappropriate for future # use cases where files are already on disk, like the opentrons CLI await self . _file_reader_writer . write ( directory = directory , files = all_files ) return ProtocolSource ( directory = directory , main_file = directory / role_analysis . main_file . name , config = config_analysis . config , metadata = config_analysis . metadata , files = [ ProtocolSourceFile ( name = f . name , role = f . role ) for f in all_files ] , labware_definitions = role_analysis . labware_definitions , )