MCPcopy
hub / github.com/MagicStack/asyncpg / _add_class

Function _add_class

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

Source from the content-addressed store, hash-verified

93 clsnames = set()
94
95 def _add_class(clsname, base, sqlstate, docstring):
96 if sqlstate:
97 sqlstate = "sqlstate = '{}'".format(sqlstate)
98 else:
99 sqlstate = ''
100
101 txt = tpl.format(clsname=clsname, base=base, sqlstate=sqlstate,
102 docstring=docstring)
103
104 if not sqlstate and not docstring:
105 txt += 'pass'
106
107 if len(txt.splitlines()[0]) > 79:
108 txt = txt.replace('(', '(\n ', 1)
109
110 classes.append(txt)
111 clsnames.add(clsname)
112
113 for line in errcodes.splitlines():
114 if not line.strip() or line.startswith('#'):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…