core: Use a set to get unique dirs, and sorted to make the output stable
This commit is contained in:
parent
9ced0f740f
commit
069ef2ae7d
@ -1,6 +1,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
|
import operator
|
||||||
import urlparse
|
import urlparse
|
||||||
|
|
||||||
import pykka
|
import pykka
|
||||||
@ -62,8 +63,8 @@ class LibraryController(object):
|
|||||||
"""
|
"""
|
||||||
if uri is None:
|
if uri is None:
|
||||||
backends = self.backends.with_library_browse.values()
|
backends = self.backends.with_library_browse.values()
|
||||||
root = [b.library.root_directory.get() for b in backends]
|
unique_dirs = {b.library.root_directory.get() for b in backends}
|
||||||
return list(collections.OrderedDict.fromkeys(root))
|
return sorted(unique_dirs, key=operator.attrgetter('name'))
|
||||||
|
|
||||||
scheme = urlparse.urlparse(uri).scheme
|
scheme = urlparse.urlparse(uri).scheme
|
||||||
backend = self.backends.with_library_browse.get(scheme)
|
backend = self.backends.with_library_browse.get(scheme)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user