MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / _parse_error

Function _parse_error

lib/sqlalchemy/dialects/postgresql/hstore.py:324–342  ·  view source on GitHub ↗

format an unmarshalling error.

(hstore_str, pos)

Source from the content-addressed store, hash-verified

322
323
324def _parse_error(hstore_str, pos):
325 """format an unmarshalling error."""
326
327 ctx = 20
328 hslen = len(hstore_str)
329
330 parsed_tail = hstore_str[max(pos - ctx - 1, 0) : min(pos, hslen)]
331 residual = hstore_str[min(pos, hslen) : min(pos + ctx + 1, hslen)]
332
333 if len(parsed_tail) > ctx:
334 parsed_tail = "[...]" + parsed_tail[1:]
335 if len(residual) > ctx:
336 residual = residual[:-1] + "[...]"
337
338 return "After %r, could not parse residual at position %d: %r" % (
339 parsed_tail,
340 pos,
341 residual,
342 )
343
344
345def _parse_hstore(hstore_str):

Callers 1

_parse_hstoreFunction · 0.85

Calls 2

maxClass · 0.85
minClass · 0.85

Tested by

no test coverage detected