| 77 | quoting = None |
| 78 | |
| 79 | def __init__(self, dialect): |
| 80 | if self.quoting is not None: |
| 81 | assert dialect.quoting == self.quoting |
| 82 | self.dialect = dialect |
| 83 | self.setup() |
| 84 | |
| 85 | escape_pattern_quoted = r'({quotechar})'.format( |
| 86 | quotechar=re.escape(self.dialect.quotechar or '"')) |
| 87 | escape_pattern_unquoted = r'([{specialchars}])'.format( |
| 88 | specialchars=re.escape(self.specialchars)) |
| 89 | |
| 90 | self.escape_re_quoted = re.compile(escape_pattern_quoted) |
| 91 | self.escape_re_unquoted = re.compile(escape_pattern_unquoted) |
| 92 | |
| 93 | def setup(self): |
| 94 | """Optional method for strategy-wide optimizations.""" |