It would be useful to add one more operation between matchers: *.
Today SignatureSeriesMatcher is useful when any one of several matchers may pass. For some APIs we need the opposite: a single matcher object that contains several checks, but succeeds only when all of them pass.
Example of the desired public shape:
matcher = PossibleCallMatcher('..') * PossibleCallMatcher('.')
matcher.match(function, raise_exception=True)
The resulting object could be a new matcher type. Its match() method should check its internal matchers with "all must pass" semantics, not "one is enough". Other than that, it would be helpful if it behaved like a regular matcher object, similarly to SignatureSeriesMatcher: composable, reusable, and accepted anywhere matcher instances are accepted.
The pristan use case is slot validation. A slot may be intentionally called by host code in several ways, for example with one positional argument and with two positional arguments. In that case, both the slot function and every plugin must support every declared call shape:
required = PossibleCallMatcher('..') * PossibleCallMatcher('.')
required.match(slot_function, raise_exception=True)
required.match(plugin_function, raise_exception=True)
There may be a better implementation or naming than this suggestion. The important part is the public behavior: * would mean combining matcher requirements so that every internal matcher has to match.
It would be useful to add one more operation between matchers:
*.Today
SignatureSeriesMatcheris useful when any one of several matchers may pass. For some APIs we need the opposite: a single matcher object that contains several checks, but succeeds only when all of them pass.Example of the desired public shape:
The resulting object could be a new matcher type. Its
match()method should check its internal matchers with "all must pass" semantics, not "one is enough". Other than that, it would be helpful if it behaved like a regular matcher object, similarly toSignatureSeriesMatcher: composable, reusable, and accepted anywhere matcher instances are accepted.The
pristanuse case is slot validation. A slot may be intentionally called by host code in several ways, for example with one positional argument and with two positional arguments. In that case, both the slot function and every plugin must support every declared call shape:There may be a better implementation or naming than this suggestion. The important part is the public behavior:
*would mean combining matcher requirements so that every internal matcher has to match.