facet.py 文件源码

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

项目:solaris-ips 作者: oracle 项目源码 文件源码
def __keylist_sort(self):
                """Update __keysort, which is used to determine facet matching
                order.  Inherited facets always take priority over local
                facets so make sure all inherited facets come before local
                facets in __keylist.  All facets from a given source are
                sorted by length, and facets of equal length are sorted
                lexically."""

                def facet_sort(x, y):
                        i = len(y) - len(x)
                        if i != 0:
                                return i
                        return misc.cmp(x, y)

                self.__keylist = []
                self.__keylist += sorted([
                        i
                        for i in self
                        if i in self.__inherited
                ], key=cmp_to_key(facet_sort))
                self.__keylist += sorted([
                        i
                        for i in self
                        if i not in self.__inherited
                ], key=cmp_to_key(facet_sort))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号