[core/themes] De-duplicate theme names
List themes only once, even if they are present multiple times in different locations. (Yes, I know that list(set(result)) would do the same, but here, I'd like to not waste memory and be a bit faster). see #203
This commit is contained in:
parent
f72ac0ca99
commit
9d7fc5c1d4
1 changed files with 4 additions and 2 deletions
|
@ -18,12 +18,14 @@ def theme_path():
|
||||||
]
|
]
|
||||||
|
|
||||||
def themes():
|
def themes():
|
||||||
result = []
|
themes = {}
|
||||||
|
|
||||||
for path in theme_path():
|
for path in theme_path():
|
||||||
for filename in glob.iglob("{}/*.json".format(path)):
|
for filename in glob.iglob("{}/*.json".format(path)):
|
||||||
if "test" not in filename:
|
if "test" not in filename:
|
||||||
result.append(os.path.basename(filename).replace(".json", ""))
|
themes[os.path.basename(filename).replace(".json", "")] = 1
|
||||||
|
result = themes.keys()
|
||||||
|
result.sort()
|
||||||
return result
|
return result
|
||||||
|
|
||||||
class Theme(object):
|
class Theme(object):
|
||||||
|
|
Loading…
Reference in a new issue