MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / _add_class

Function _add_class

tools/generate_exceptions.py:104–120  ·  view source on GitHub ↗
(clsname, base, sqlstate, docstring)

Source from the content-addressed store, hash-verified

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('#'):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected