def match_key(self) -> Tuple[bool, bool, int, List[WeightedPart]]:
        """A Key to sort the rules by weight for matching.

        The key leads to ordering:

         - By first order by defaults as they are simple rules without
           conversions.
         - Then on the complexity of the rule, i.e. does it have any
           converted parts. This is as simple rules are quick to match
           or reject.
         - Then by the number of parts, with more complex (more parts)
           first.
         - Finally by the weights themselves. Note that weights are also
           sub keyed by converter first then weight second.
        """
        if self.map is None:
            raise RuntimeError(f"{self!r} is not bound to a Map")
        complex_rule = any(weight.converter for weight in self._weights)
        return (not bool(self.defaults), complex_rule, -len(self._weights), self._weights)
def match_key ( self ) -> Tuple [ bool , bool , int , List [ WeightedPart ] ] : if self . map is None : raise RuntimeError ( f"{self!r} is not bound to a Map" ) complex_rule = any ( weight . converter for weight in self . _weights ) return ( not bool ( self . defaults ) , complex_rule , - len ( self . _weights ) , self . _weights )
A Key to sort the rules by weight for matching.

        The key leads to ordering:

         - By first order by defaults as they are simple rules without
           conversions.
         - Then on the complexity of the rule, i.e. does it have any
           converted parts. This is as simple rules are quick to match
           or reject.
         - Then by the number of parts, with more complex (more parts)
           first.
         - Finally by the weights themselves. Note that weights are also
           sub keyed by converter first then weight second.