当前位置: 首页>>代码示例>>Python>>正文


Python util.human_sort_key函数代码示例

本文整理汇总了Python中quodlibet.util.human_sort_key函数的典型用法代码示例。如果您正苦于以下问题:Python human_sort_key函数的具体用法?Python human_sort_key怎么用?Python human_sort_key使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了human_sort_key函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: cmp_rows

        def cmp_rows(model, i1, i2, data):
            t1, t2 = model[i1][0], model[i2][0]
            pos1 = _ORDERING.get(t1, 0)
            pos2 = _ORDERING.get(t2, 0)
            if pos1 or pos2:
                return cmp(pos1, pos2)

            if not isinstance(t1, AlbumNode):
                return cmp(util.human_sort_key(t1), util.human_sort_key(t2))

            a1, a2 = t1.album, t2.album
            return (cmp(a1.peoplesort and a1.peoplesort[0],
                        a2.peoplesort and a2.peoplesort[0]) or
                    cmp(a1.date or "ZZZZ", a2.date or "ZZZZ") or
                    cmp((a1.sort, a1.key), (a2.sort, a2.key)))
开发者ID:elfalem,项目名称:quodlibet,代码行数:15,代码来源:main.py

示例2: sort_key

def sort_key(song):
    """Sort by path so untagged albums have a good start order. Also
    take into account the directory in case it's split in different folders
    by medium.
    """

    return util.human_sort_key(path.fsdecode(song("~filename")))
开发者ID:bernd-wechner,项目名称:quodlibet,代码行数:7,代码来源:widgets.py

示例3: __human_sort_key

 def __human_sort_key(self, text, reg=re.compile('<.*?>')):
     try:
         return self.__sort_cache[text]
     except KeyError:
         # remove the markup so it doesn't affect the sort order
         if self.pattern.has_markup:
             text = reg.sub("", text)
         self.__sort_cache[text] = util.human_sort_key(text)
         return self.__sort_cache[text]
开发者ID:silkecho,项目名称:glowing-silk,代码行数:9,代码来源:paned.py

示例4: sort

        def sort(model, i1, i2, data):
            t1, t2 = model[i1][0], model[i2][0]
            if t1 is None or t2 is None:
                # FIXME: why?
                return 0

            # FIXME: order this deterministically
            if t1 is MultiNode or t1 is UnknownNode or \
                    t2 is MultiNode or t2 is UnknownNode:
                return -cmp(t1, t2)

            if not isinstance(t1, Album):
                return cmp(util.human_sort_key(t1), util.human_sort_key(t2))

            a1, a2 = t1, t2
            return (cmp(a1.peoplesort and a1.peoplesort[0],
                        a2.peoplesort and a2.peoplesort[0]) or
                        cmp(a1.date or "ZZZZ", a2.date or "ZZZZ") or
                        cmp((a1.sort, a1.key), (a2.sort, a2.key)))
开发者ID:faubiguy,项目名称:quodlibet,代码行数:19,代码来源:main.py

示例5: __human_sort_key

 def __human_sort_key(self, text, reg=re.compile('<.*?>')):
     try:
         return self.__sort_cache[text], text
     except KeyError:
         # remove the markup so it doesn't affect the sort order
         if self.config.has_markup:
             text_stripped = reg.sub("", text)
         else:
             text_stripped = text
         self.__sort_cache[text] = util.human_sort_key(text_stripped)
         return self.__sort_cache[text], text
开发者ID:MikeiLL,项目名称:quodlibet,代码行数:11,代码来源:models.py

示例6: __init__

 def __init__(self, song):
     super(Album, self).__init__()
     self.songs = set()
     #albumsort is part of the album_key, so every song has the same
     self.sort = util.human_sort_key(song("albumsort"))
     self.key = song.album_key
开发者ID:silkecho,项目名称:glowing-silk,代码行数:6,代码来源:collection.py

示例7: genre

 def genre(self):
     return util.human_sort_key(self.get("genre").split("\n")[0])
开发者ID:silkecho,项目名称:glowing-silk,代码行数:2,代码来源:collection.py

示例8: peoplesort

 def peoplesort(self):
     return util.human_sort_key(self.get("~peoplesort").split("\n")[0])
开发者ID:silkecho,项目名称:glowing-silk,代码行数:2,代码来源:collection.py

示例9: test_white

 def test_white(self):
     self.failUnlessEqual(
         util.human_sort_key(u"  3foo    bar6 42.8"),
         util.human_sort_key(u"3 foo bar6  42.8  "))
     self.failUnlessEqual(64.0 in util.human_sort_key(u"64. 8"), True)
开发者ID:brunob,项目名称:quodlibet,代码行数:5,代码来源:test_util.py

示例10: test_false

 def test_false(self):
     # album browser needs that to sort albums without artist/title
     # to the bottom
     self.failIf(util.human_sort_key(""))
开发者ID:brunob,项目名称:quodlibet,代码行数:4,代码来源:test_util.py

示例11: smaller

 def smaller(self, x, y):
     return util.human_sort_key(x) < util.human_sort_key(y)
开发者ID:brunob,项目名称:quodlibet,代码行数:2,代码来源:test_util.py

示例12: _get_key

 def _get_key(song, tag):
     if tag.startswith("~#") and "~" not in tag[2:]:
         return song(tag)
     return human_sort_key(song(tag))
开发者ID:silkecho,项目名称:glowing-silk,代码行数:4,代码来源:songlist.py

示例13: equal

 def equal(self, x, y):
     return util.human_sort_key(x) == util.human_sort_key(y)
开发者ID:Muges,项目名称:quodlibet,代码行数:2,代码来源:test_util.py


注:本文中的quodlibet.util.human_sort_key函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。