paths.py 文件源码

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

项目:xphyle 作者: jdidion 项目源码 文件源码
def find(
            self, root: PathLike = None,
            recursive: bool = False) -> Sequence[PathInst]:
        """Find all paths in `root` matching this spec.

        Args:
            root: Directory in which to begin the search.
            recursive: Whether to search recursively.

        Returns:
            A sequence of PathInst.
        """
        if root is None:
            root = self.default_search_root()
        find_results = find(
            root, self.pattern, path_types=[self.path_type],
            recursive=recursive, return_matches=True)
        matches = dict(
            (path, self._match_to_dict(match, errors=False))
            for path, match in cast(
                Sequence[Tuple[str, Match[str]]], find_results))
        return [
            path_inst(path, match)
            for path, match in matches.items()
            if match is not None]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号