(astr)
| 140 | parenrep = re.compile(r"\(([^)]*)\)\*(\d+)") |
| 141 | plainrep = re.compile(r"([^*]+)\*(\d+)") |
| 142 | def parse_values(astr): |
| 143 | # replaces all occurrences of '(a,b,c)*4' in astr |
| 144 | # with 'a,b,c,a,b,c,a,b,c,a,b,c'. Empty braces generate |
| 145 | # empty values, i.e., ()*4 yields ',,,'. The result is |
| 146 | # split at ',' and a list of values returned. |
| 147 | astr = parenrep.sub(paren_repl, astr) |
| 148 | # replaces occurrences of xxx*3 with xxx, xxx, xxx |
| 149 | astr = ','.join([plainrep.sub(paren_repl, x.strip()) |
| 150 | for x in astr.split(',')]) |
| 151 | return astr.split(',') |
| 152 | |
| 153 | |
| 154 | stripast = re.compile(r"\n\s*\*?") |
no test coverage detected