whatstyle.py 文件源码

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

项目:whatstyle 作者: mikr 项目源码 文件源码
def formatters_for_files(filenames):
    # type: (List[str]) -> List[str]
    """Returns a list of formatter names that support every extension of these filenames.
    """
    exts = set()  # type: Set[str]
    for f in filenames:
        root, ext = os.path.splitext(f)
        ext = ext.lower()
        if not ext and root.startswith('.'):
            # Recognize extension-only filenames as well.
            ext = root.lower()
        exts.add(ext)
    supported = []
    for fmt, fmtexts in SUPPORTED_EXTS:
        fmt_exts = set(fmtexts.split())  # type: Set[str]
        if not exts or exts.issubset(fmt_exts):
            supported.append(fmt)
    return supported
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号