MCPcopy
hub / github.com/docopt/docopt / fix_repeating_arguments

Method fix_repeating_arguments

docopt.py:57–69  ·  view source on GitHub ↗

Fix elements that should accumulate/increment values.

(self)

Source from the content-addressed store, hash-verified

55 c.fix_identities(uniq)
56
57 def fix_repeating_arguments(self):
58 """Fix elements that should accumulate/increment values."""
59 either = [list(c.children) for c in self.either.children]
60 for case in either:
61 for e in [c for c in case if case.count(c) > 1]:
62 if type(e) is Argument or type(e) is Option and e.argcount:
63 if e.value is None:
64 e.value = []
65 elif type(e.value) is not list:
66 e.value = e.value.split()
67 if type(e) is Command or type(e) is Option and e.argcount == 0:
68 e.value = 0
69 return self
70
71 @property
72 def either(self):

Callers 2

fixMethod · 0.95

Calls

no outgoing calls

Tested by 1