From 9d60aed5dec208d11947055b4ce0180a9e30b11f Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Fri, 19 Jul 2024 00:02:36 +0200 Subject: [PATCH] Remove useless sort key for selectors Tuples are already sorted that way. --- cssselect2/__init__.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/cssselect2/__init__.py b/cssselect2/__init__.py index 923b9c5..28baced 100644 --- a/cssselect2/__init__.py +++ b/cssselect2/__init__.py @@ -6,8 +6,6 @@ """ -import operator - from webencodings import ascii_lower # Classes are imported here to expose them at the top level of the module @@ -109,7 +107,7 @@ def match(self, element): self.add_relevant_selectors( element, self.other_selectors, relevant_selectors) - relevant_selectors.sort(key=SORT_KEY) + relevant_selectors.sort() return relevant_selectors @staticmethod @@ -118,6 +116,3 @@ def add_relevant_selectors(element, selectors, relevant_selectors): if test(element): relevant_selectors.append( (specificity, order, pseudo, payload)) - - -SORT_KEY = operator.itemgetter(0, 1)