Skip to content

Commit

Permalink
Remove useless sort key for selectors
Browse files Browse the repository at this point in the history
Tuples are already sorted that way.
  • Loading branch information
liZe committed Jul 18, 2024
1 parent d65a4e4 commit 9d60aed
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions cssselect2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)

0 comments on commit 9d60aed

Please sign in to comment.