def list(self, path="<STR_LIT>", *, recursive=False, raw_command=None):
class AsyncLister(AsyncListerMixin):<EOL><INDENT>stream = None<EOL>async def _new_stream(cls, local_path):<EOL><INDENT>cls.path = local_path<EOL>cls.parse_line = self.parse_mlsx_line<EOL>if raw_command not in [None, "<STR_LIT>", "<STR_LIT>"]:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>f"<STR_LIT>")<EOL><DEDENT>if raw_command in [None, "<STR_LIT>"]:<EOL><INDENT>try:<EOL><INDENT>command = ("<STR_LIT>" + str(cls.path)).strip()<EOL>return await self.get_stream(command, "<STR_LIT>")<EOL><DEDENT>except errors.StatusCodeError as e:<EOL><INDENT>code = e.received_codes[-<NUM_LIT:1>]<EOL>if not code.matches("<STR_LIT>") or raw_command is not None:<EOL><INDENT>raise<EOL><DEDENT><DEDENT><DEDENT>if raw_command in [None, "<STR_LIT>"]:<EOL><INDENT>cls.parse_line = self.parse_list_line<EOL>command = ("<STR_LIT>" + str(cls.path)).strip()<EOL>return await self.get_stream(command, "<STR_LIT>")<EOL><DEDENT><DEDENT>def __aiter__(cls):<EOL><INDENT>cls.directories = collections.deque()<EOL>return cls<EOL><DEDENT>async def __anext__(cls):<EOL><INDENT>if cls.stream is None:<EOL><INDENT>cls.stream = await cls._new_stream(path)<EOL><DEDENT>while True:<EOL><INDENT>line = await cls.stream.readline()<EOL>while not line:<EOL><INDENT>await cls.stream.finish()<EOL>if cls.directories:<EOL><INDENT>current_path, info = cls.directories.popleft()<EOL>cls.stream = await cls._new_stream(current_path)<EOL>line = await cls.stream.readline()<EOL><DEDENT>else:<EOL><INDENT>raise StopAsyncIteration<EOL><DEDENT><DEDENT>try:<EOL><INDENT>name, info = cls.parse_line(line)<EOL><DEDENT>except Exception:<EOL><INDENT>continue<EOL><DEDENT>stat = cls.path / name, info<EOL>if info["<STR_LIT:type>"] == "<STR_LIT>" and recursive:<EOL><INDENT>cls.directories.append(stat)<EOL><DEDENT>return stat<EOL><DEDENT><DEDENT><DEDENT>return AsyncLister()<EOL>
:py:func:`asyncio.coroutine`

List all files and directories in "path".

:param path: directory or file path
:type path: :py:class:`str` or :py:class:`pathlib.PurePosixPath`

:param recursive: list recursively
:type recursive: :py:class:`bool`

:param raw_command: optional ftp command to use in place of
    fallback logic (must be one of "MLSD", "LIST")
:type raw_command: :py:class:`str`

:rtype: :py:class:`list` or `async for` context

::

    >>> # lazy list
    >>> async for path, info in client.list():
    ...     # no interaction with client should be here(!)

    >>> # eager list
    >>> for path, info in (await client.list()):
    ...     # interaction with client allowed, since all paths are
    ...     # collected already

::

    >>> stats = await client.list()