| 102 | clsnames = set() |
| 103 | |
| 104 | def _add_class(clsname, base, sqlstate, docstring): |
| 105 | if sqlstate: |
| 106 | sqlstate = "sqlstate = '{}'".format(sqlstate) |
| 107 | else: |
| 108 | sqlstate = '' |
| 109 | |
| 110 | txt = tpl.format(clsname=clsname, base=base, sqlstate=sqlstate, |
| 111 | docstring=docstring) |
| 112 | |
| 113 | if not sqlstate and not docstring: |
| 114 | txt += 'pass' |
| 115 | |
| 116 | if len(txt.splitlines()[0]) > 79: |
| 117 | txt = txt.replace('(', '(\n ', 1) |
| 118 | |
| 119 | classes.append(txt) |
| 120 | clsnames.add(clsname) |
| 121 | |
| 122 | for line in errcodes.splitlines(): |
| 123 | if not line.strip() or line.startswith('#'): |