filters.py 文件源码

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

项目:pynd 作者: d0ugal 项目源码 文件源码
def get_all_filters():
    """Return all the available filters"""
    return (
        # TODO: Add ast.Module to the docstring search.
        DocString('d', 'doc', (ast.FunctionDef, ast.ClassDef, ast.Module),
                  help="Match class and function docstrings."),
        NameFilter('c', 'class', (ast.ClassDef, ),
                  help="Match class names."),
        DefFilter('f', 'def', (ast.FunctionDef, ), (ast.AST, ),
                  help="Match all defs."),
        DefFilter('F', 'function', (ast.FunctionDef, ), (ast.Module, ),
                  help="Match function names at the module level."),
        DefFilter('m', 'method', (ast.FunctionDef, ), (ast.ClassDef, ),
                  help="Match class method names."),
        DefFilter('j', 'closure', (ast.FunctionDef, ), (ast.FunctionDef, ),
                  help="Match closure def names."),
        ImportFilter('i', 'import', (ast.Import, ast.ImportFrom, ),
                     help="Match imported package names."),
        CallFilter('C', 'call', (ast.Call, ),
                  help="Match call statements."),
        AttrFilter('a', 'attr', (ast.Attribute, ),
                  help="Match attributes on objects"),
    )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号