MCPcopy Index your code
hub / github.com/docopt/docopt / Either

Class Either

docopt.py:275–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273
274
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 7

test_parse_patternFunction · 0.90
test_command_matchFunction · 0.90
test_either_matchFunction · 0.90
test_pattern_eitherFunction · 0.90
eitherMethod · 0.85
parse_exprFunction · 0.85

Calls

no outgoing calls

Tested by 5

test_parse_patternFunction · 0.72
test_command_matchFunction · 0.72
test_either_matchFunction · 0.72
test_pattern_eitherFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…