Skip to content

Commit

Permalink
sort list of modules case-insensitive (#56)
Browse files Browse the repository at this point in the history
* lmod interface sorts list of modules case-insensitive
* use order of loaded modules returned by Lmod
  • Loading branch information
lexming authored Mar 23, 2023
1 parent 465129b commit 43c2395
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion jupyterlab/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class LmodWidget extends Widget {
Promise.all([lmodAPI.avail(), lmodAPI.list()])
.then(values => {
const avail_set = new Set<string>(values[0]);
const modulelist = values[1].sort();
const modulelist = values[1];
const html_list = modulelist.map(item => createModuleItem(item, 'Unload'));

this.loadedUList.innerText = '';
Expand Down
4 changes: 2 additions & 2 deletions lmod/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async def avail(self, *args):
string = await module("avail", *args)
if string is not None:
modules = MODULE_REGEX.findall(string.strip())
modules.sort(key=lambda v: v.split("/")[0])
modules.sort(key=lambda v: v.split("/")[0].lower())
else:
modules = []
self.avail_cache = modules
Expand Down Expand Up @@ -217,4 +217,4 @@ async def unuse(self, *paths):
purge = _lmod.purge
show = _lmod.show
use = _lmod.use
unuse = _lmod.unuse
unuse = _lmod.unuse

0 comments on commit 43c2395

Please sign in to comment.