MCPcopy Index your code
hub / github.com/RustPython/RustPython / matches

Method matches

Lib/test/support/__init__.py:1557–1572  ·  view source on GitHub ↗

Try to match a single dict with the supplied arguments. Keys whose values are strings and which are in self._partial_matches will be checked for partial (i.e. substring) matches. You can extend this scheme to (for example) do regular expression matching, etc.

(self, d, **kwargs)

Source from the content-addressed store, hash-verified

1555 _partial_matches = ('msg', 'message')
1556
1557 def matches(self, d, **kwargs):
1558 """
1559 Try to match a single dict with the supplied arguments.
1560
1561 Keys whose values are strings and which are in self._partial_matches
1562 will be checked for partial (i.e. substring) matches. You can extend
1563 this scheme to (for example) do regular expression matching, etc.
1564 """
1565 result = True
1566 for k in kwargs:
1567 v = kwargs[k]
1568 dv = d.get(k)
1569 if not self.match_value(k, dv, v):
1570 result = False
1571 break
1572 return result
1573
1574 def match_value(self, k, dv, v):
1575 """

Callers 1

slot_initMethod · 0.45

Calls 2

match_valueMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected