MCPcopy Create free account
hub / github.com/PlatformLab/NanoLog / fix_repeating_arguments

Method fix_repeating_arguments

preprocessor/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 child.fix_identities(uniq)
56
57 def fix_repeating_arguments(self):
58 """Fix elements that should accumulate/increment values."""
59 either = [list(child.children) for child in transform(self).children]
60 for case in either:
61 for e in [child for child in case if case.count(child) > 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
72def transform(pattern):

Callers 1

fixMethod · 0.95

Calls 1

transformFunction · 0.85

Tested by

no test coverage detected