MCPcopy
hub / github.com/docopt/docopt / match

Method match

docopt.py:277–286  ·  view source on GitHub ↗
(self, left, collected=None)

Source from the content-addressed store, hash-verified

275class Either(ParentPattern):
276
277 def match(self, left, collected=None):
278 collected = [] if collected is None else collected
279 outcomes = []
280 for p in self.children:
281 matched, _, _ = outcome = p.match(left, collected)
282 if matched:
283 outcomes.append(outcome)
284 if outcomes:
285 return min(outcomes, key=lambda outcome: len(outcome[1]))
286 return False, left, collected
287
288
289class TokenStream(list):

Callers 12

matchMethod · 0.45
matchMethod · 0.45
matchMethod · 0.45
docoptFunction · 0.45
test_option_matchFunction · 0.45
test_argument_matchFunction · 0.45
test_command_matchFunction · 0.45
test_optional_matchFunction · 0.45
test_required_matchFunction · 0.45
test_either_matchFunction · 0.45
test_one_or_more_matchFunction · 0.45
test_list_argument_matchFunction · 0.45

Calls

no outgoing calls

Tested by 8

test_option_matchFunction · 0.36
test_argument_matchFunction · 0.36
test_command_matchFunction · 0.36
test_optional_matchFunction · 0.36
test_required_matchFunction · 0.36
test_either_matchFunction · 0.36
test_one_or_more_matchFunction · 0.36
test_list_argument_matchFunction · 0.36