Fix elements that should accumulate/increment values.
(self)
| 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): |
no outgoing calls