Fix sorting in list_cmaps when records=True by replacing None with empty string
@@ -19,7 +19,7 @@ from ..core.ndmapping import item_check
from ..core.spaces import get_nested_streams
from ..core.util import (
match_spec, wrap_tuple, get_overlay_spec, unique_iterator,
- closest_match, is_number, isfinite, python2sort, disable_constant,
+ closest_match, is_number, isfinite, disable_constant,
arraylike_types
)
from ..element import Points
@@ -791,8 +791,10 @@ def list_cmaps(provider=None, records=False, name=None, category=None, source=No
# Return results sorted by category if category information is provided
if records:
- return list(unique_iterator(python2sort(matches,
- key=lambda r: (r.category.split(" ")[-1],r.bg,r.name.lower(),r.provider,r.source))))
+ return sorted(
+ matches,
+ key=lambda r: (r.category.split(" ")[-1], r.bg or "", r.name.lower(), r.provider, r.source or "")
+ )
else:
return list(unique_iterator(sorted([rec.name for rec in matches], key=lambda n:n.lower())))
