Spandoc.py 文件源码

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

项目:Spandoc 作者: geniusupgrader 项目源码 文件源码
def get_transformation_list(self, settings, view):
        '''Generates a ranked list of available transformations.'''

        # score the transformations and rank them
        ranked = {}
        for label, setting in settings['transformations'].items():
            for scope in setting['scope']:
                score = view.score_selector(0, scope)
                if not score:
                    continue
                if label not in ranked or ranked[label] < score:
                    ranked[label] = score

        if not len(ranked):
            sublime.error_message('No transformations configured for the syntax '+ view.settings().get('syntax'))
            return

        # reverse sort
        transformation_list = list(OrderedDict(sorted(
            ranked.items(), key=lambda t: t[1])).keys())
        transformation_list.reverse()
        return transformation_list
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号