diff --git a/mlx/traceable_collection.py b/mlx/traceable_collection.py index c34c258c..7defdd18 100644 --- a/mlx/traceable_collection.py +++ b/mlx/traceable_collection.py @@ -298,7 +298,7 @@ def get_items(self, regex, attributes=None, sortattributes=None, reverse=False, Args: regex (str/re.Pattern): Regex pattern or object to match the items in this collection against attributes (dict): Dictionary with attribute-regex pairs to match the items in this collection against - sortattributes (list): List of attributes on which to alphabetically sort the items + sortattributes (list): List of attributes on which to naturally sort the items reverse (bool): True for reverse sorting sort (bool): When sortattributes is falsy: True to enable natural sorting, False to disable sorting @@ -313,8 +313,8 @@ def get_items(self, regex, attributes=None, sortattributes=None, reverse=False, if item.is_match(regex) and (not attributes or item.attributes_match(attributes)): matches.append(itemid) if sortattributes: - return sorted(matches, key=lambda itemid: self.get_item(itemid).get_attributes(sortattributes), - reverse=reverse) + return natsorted(matches, key=lambda itemid: self.get_item(itemid).get_attributes(sortattributes), + reverse=reverse) elif sort: return natsorted(matches, reverse=reverse) return matches