store the macro value, as a single string which can be executed
(self,code)
| 21 | """ |
| 22 | |
| 23 | def __init__(self,code): |
| 24 | """store the macro value, as a single string which can be executed""" |
| 25 | lines = [] |
| 26 | enc = None |
| 27 | for line in code.splitlines(): |
| 28 | coding_match = coding_declaration.match(line) |
| 29 | if coding_match: |
| 30 | enc = coding_match.group(1) |
| 31 | else: |
| 32 | lines.append(line) |
| 33 | code = "\n".join(lines) |
| 34 | if isinstance(code, bytes): |
| 35 | code = code.decode(enc or DEFAULT_ENCODING) |
| 36 | self.value = code + '\n' |
| 37 | |
| 38 | def __str__(self): |
| 39 | return self.value |