ftputil.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:hgvm-builder 作者: BD2KGenomics 项目源码 文件源码
def list_children(self, path):
        """
        Yield all direct children of the given root-relative path, as root-
        relative paths. If the path refers to a file, there will be no children.
        """

        if len(path) > 0 and not path.endswith("/"):
            # We need a trailing slash after a real directory name for urljoin
            # to work later
            path = path + "/"

        # Strip leading slashes from the input path, so we always look inside
        # our base path.
        path = path.lstrip("/")

        # Construct the path to actually go to on the FTP server
        ftp_path = urlparse.urljoin(self.base_path, path)

        Logger.debug("Listing {}".format(ftp_path))

        for child in robust_nlst(self.connection, ftp_path):
            # For every child, build a root-relative URL
            yield urlparse.urljoin(path, child)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号