id
int64
0
843k
repository_name
stringlengths
7
55
file_path
stringlengths
9
332
class_name
stringlengths
3
290
human_written_code
stringlengths
12
4.36M
class_skeleton
stringlengths
19
2.2M
total_program_units
int64
1
9.57k
total_doc_str
int64
0
4.2k
AvgCountLine
float64
0
7.89k
AvgCountLineBlank
float64
0
300
AvgCountLineCode
float64
0
7.89k
AvgCountLineComment
float64
0
7.89k
AvgCyclomatic
float64
0
130
CommentToCodeRatio
float64
0
176
CountClassBase
float64
0
48
CountClassCoupled
float64
0
589
CountClassCoupledModified
float64
0
581
CountClassDerived
float64
0
5.37k
CountDeclInstanceMethod
float64
0
4.2k
CountDeclInstanceVariable
float64
0
299
CountDeclMethod
float64
0
4.2k
CountDeclMethodAll
float64
0
4.2k
CountLine
float64
1
115k
CountLineBlank
float64
0
9.01k
CountLineCode
float64
0
94.4k
CountLineCodeDecl
float64
0
46.1k
CountLineCodeExe
float64
0
91.3k
CountLineComment
float64
0
27k
CountStmt
float64
1
93.2k
CountStmtDecl
float64
0
46.1k
CountStmtExe
float64
0
90.2k
MaxCyclomatic
float64
0
759
MaxInheritanceTree
float64
0
16
MaxNesting
float64
0
34
SumCyclomatic
float64
0
6k
148,548
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.FileNameTooLongError
class FileNameTooLongError(PostgresSystemError): sqlstate = '58P03'
class FileNameTooLongError(PostgresSystemError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,549
MagicStack/asyncpg
MagicStack_asyncpg/tests/test_record.py
tests.test_record.AnotherCustomRecord
class AnotherCustomRecord(asyncpg.Record): pass
class AnotherCustomRecord(asyncpg.Record): pass
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
0
2
1
1
0
2
1
1
0
0
0
0
148,550
MagicStack/asyncpg
MagicStack_asyncpg/tests/test_test.py
tests.test_test.BaseSimpleTestCase
class BaseSimpleTestCase: async def test_tests_zero_error(self): await asyncio.sleep(0.01) 1 / 0
class BaseSimpleTestCase: async def test_tests_zero_error(self): pass
2
0
3
0
3
0
1
0
0
0
0
0
1
0
1
1
5
1
4
2
2
0
4
2
2
1
0
0
1
148,551
MagicStack/asyncpg
MagicStack_asyncpg/tests/test_timeout.py
tests.test_timeout.TestTimeout
class TestTimeout(tb.ConnectedTestCase): async def test_timeout_01(self): for methname in {'fetch', 'fetchrow', 'fetchval', 'execute'}: with self.assertRaises(asyncio.TimeoutError), \ self.assertRunUnder(MAX_RUNTIME): meth = getattr(self.con, methname) await meth('select pg_sleep(10)', timeout=0.02) self.assertEqual(await self.con.fetch('select 1'), [(1,)]) async def test_timeout_02(self): st = await self.con.prepare('select pg_sleep(10)') for methname in {'fetch', 'fetchrow', 'fetchval'}: with self.assertRaises(asyncio.TimeoutError), \ self.assertRunUnder(MAX_RUNTIME): meth = getattr(st, methname) await meth(timeout=0.02) self.assertEqual(await self.con.fetch('select 1'), [(1,)]) async def test_timeout_03(self): task = self.loop.create_task( self.con.fetch('select pg_sleep(10)', timeout=0.2)) await asyncio.sleep(0.05) task.cancel() with self.assertRaises(asyncio.CancelledError), \ self.assertRunUnder(MAX_RUNTIME): await task self.assertEqual(await self.con.fetch('select 1'), [(1,)]) async def test_timeout_04(self): st = await self.con.prepare('select pg_sleep(10)', timeout=0.1) with self.assertRaises(asyncio.TimeoutError), \ self.assertRunUnder(MAX_RUNTIME): async with self.con.transaction(): async for _ in st.cursor(timeout=0.1): # NOQA pass self.assertEqual(await self.con.fetch('select 1'), [(1,)]) st = await self.con.prepare('select pg_sleep(10)', timeout=0.1) async with self.con.transaction(): cur = await st.cursor() with self.assertRaises(asyncio.TimeoutError), \ self.assertRunUnder(MAX_RUNTIME): await cur.fetch(1, timeout=0.1) self.assertEqual(await self.con.fetch('select 1'), [(1,)]) async def test_timeout_05(self): # Stress-test timeouts - try to trigger a race condition # between a cancellation request to Postgres and next # query (SELECT 1) for _ in range(500): with self.assertRaises(asyncio.TimeoutError): await self.con.fetch('SELECT pg_sleep(1)', timeout=1e-10) self.assertEqual(await self.con.fetch('SELECT 1'), [(1,)]) async def test_timeout_06(self): async with self.con.transaction(): with self.assertRaises(asyncio.TimeoutError), \ self.assertRunUnder(MAX_RUNTIME): async for _ in self.con.cursor( # NOQA 'select pg_sleep(10)', timeout=0.1): pass self.assertEqual(await self.con.fetch('select 1'), [(1,)]) async with self.con.transaction(): cur = await self.con.cursor('select pg_sleep(10)') with self.assertRaises(asyncio.TimeoutError), \ self.assertRunUnder(MAX_RUNTIME): await cur.fetch(1, timeout=0.1) async with self.con.transaction(): cur = await self.con.cursor('select pg_sleep(10)') with self.assertRaises(asyncio.TimeoutError), \ self.assertRunUnder(MAX_RUNTIME): await cur.forward(1, timeout=1e-10) async with self.con.transaction(): cur = await self.con.cursor('select pg_sleep(10)') with self.assertRaises(asyncio.TimeoutError), \ self.assertRunUnder(MAX_RUNTIME): await cur.fetchrow(timeout=0.1) async with self.con.transaction(): cur = await self.con.cursor('select pg_sleep(10)') with self.assertRaises(asyncio.TimeoutError), \ self.assertRunUnder(MAX_RUNTIME): await cur.fetchrow(timeout=0.1) with self.assertRaises(asyncpg.InFailedSQLTransactionError): await cur.fetch(1) self.assertEqual(await self.con.fetch('select 1'), [(1,)]) async def test_invalid_timeout(self): for command_timeout in ('a', False, -1): with self.subTest(command_timeout=command_timeout): with self.assertRaisesRegex(ValueError, 'invalid command_timeout'): await self.connect(command_timeout=command_timeout) # Note: negative timeouts are OK for method calls. for methname in {'fetch', 'fetchrow', 'fetchval', 'execute'}: for timeout in ('a', False): with self.subTest(timeout=timeout): with self.assertRaisesRegex(ValueError, 'invalid timeout'): await self.con.execute('SELECT 1', timeout=timeout)
class TestTimeout(tb.ConnectedTestCase): async def test_timeout_01(self): pass async def test_timeout_02(self): pass async def test_timeout_03(self): pass async def test_timeout_04(self): pass async def test_timeout_05(self): pass async def test_timeout_06(self): pass async def test_invalid_timeout(self): pass
8
0
14
1
12
1
2
0.07
1
3
0
0
7
0
7
7
107
16
87
23
79
6
74
23
66
4
1
4
15
148,552
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidColumnReferenceError
class InvalidColumnReferenceError(SyntaxOrAccessError): sqlstate = '42P10'
class InvalidColumnReferenceError(SyntaxOrAccessError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,553
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidColumnDefinitionError
class InvalidColumnDefinitionError(SyntaxOrAccessError): sqlstate = '42611'
class InvalidColumnDefinitionError(SyntaxOrAccessError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,554
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidCharacterValueForCastError
class InvalidCharacterValueForCastError(DataError): sqlstate = '22018'
class InvalidCharacterValueForCastError(DataError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,555
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidCatalogNameError
class InvalidCatalogNameError(_base.PostgresError): sqlstate = '3D000'
class InvalidCatalogNameError(_base.PostgresError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
5
0
0
148,556
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.NoActiveSQLTransactionForBranchTransactionError
class NoActiveSQLTransactionForBranchTransactionError( InvalidTransactionStateError): sqlstate = '25005'
class NoActiveSQLTransactionForBranchTransactionError( InvalidTransactionStateError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
3
0
3
3
1
0
2
2
1
0
6
0
0
148,557
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.NoAdditionalDynamicResultSetsReturned
class NoAdditionalDynamicResultSetsReturned(NoData): sqlstate = '02001'
class NoAdditionalDynamicResultSetsReturned(NoData): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
33
2
0
2
2
1
0
2
2
1
0
7
0
0
148,558
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.NoData
class NoData(PostgresWarning): sqlstate = '02000'
class NoData(PostgresWarning): pass
1
0
0
0
0
0
0
0
1
0
0
1
0
0
0
33
2
0
2
2
1
0
2
2
1
0
6
0
0
148,559
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.PostgresConnectionError
class PostgresConnectionError(_base.PostgresError): sqlstate = '08000'
class PostgresConnectionError(_base.PostgresError): pass
1
0
0
0
0
0
0
0
1
0
0
6
0
0
0
31
2
0
2
2
1
0
2
2
1
0
5
0
0
148,560
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.NoSQLJsonItemError
class NoSQLJsonItemError(DataError): sqlstate = '22035'
class NoSQLJsonItemError(DataError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,561
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.NonNumericSQLJsonItemError
class NonNumericSQLJsonItemError(DataError): sqlstate = '22036'
class NonNumericSQLJsonItemError(DataError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,562
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidCachedStatementError
class InvalidCachedStatementError(FeatureNotSupportedError): pass
class InvalidCachedStatementError(FeatureNotSupportedError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
1
1
0
2
1
1
0
6
0
0
148,563
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidBinaryRepresentationError
class InvalidBinaryRepresentationError(DataError): sqlstate = '22P03'
class InvalidBinaryRepresentationError(DataError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,564
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidAuthorizationSpecificationError
class InvalidAuthorizationSpecificationError(_base.PostgresError): sqlstate = '28000'
class InvalidAuthorizationSpecificationError(_base.PostgresError): pass
1
0
0
0
0
0
0
0
1
0
0
1
0
0
0
31
2
0
2
2
1
0
2
2
1
0
5
0
0
148,565
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidArgumentForXqueryError
class InvalidArgumentForXqueryError(_base.PostgresError): sqlstate = '10608'
class InvalidArgumentForXqueryError(_base.PostgresError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
5
0
0
148,566
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidArgumentForWidthBucketFunctionError
class InvalidArgumentForWidthBucketFunctionError(DataError): sqlstate = '2201G'
class InvalidArgumentForWidthBucketFunctionError(DataError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,567
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidArgumentForSQLJsonDatetimeFunctionError
class InvalidArgumentForSQLJsonDatetimeFunctionError(DataError): sqlstate = '22031'
class InvalidArgumentForSQLJsonDatetimeFunctionError(DataError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,568
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidArgumentForPowerFunctionError
class InvalidArgumentForPowerFunctionError(DataError): sqlstate = '2201F'
class InvalidArgumentForPowerFunctionError(DataError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,569
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidArgumentForNtileFunctionError
class InvalidArgumentForNtileFunctionError(DataError): sqlstate = '22014'
class InvalidArgumentForNtileFunctionError(DataError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,570
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidArgumentForNthValueFunctionError
class InvalidArgumentForNthValueFunctionError(DataError): sqlstate = '22016'
class InvalidArgumentForNthValueFunctionError(DataError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,571
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.FDWUnableToEstablishConnectionError
class FDWUnableToEstablishConnectionError(FDWError): sqlstate = 'HV00N'
class FDWUnableToEstablishConnectionError(FDWError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,572
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.FDWUnableToCreateExecutionError
class FDWUnableToCreateExecutionError(FDWError): sqlstate = 'HV00L'
class FDWUnableToCreateExecutionError(FDWError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,573
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.FDWTooManyHandlesError
class FDWTooManyHandlesError(FDWError): sqlstate = 'HV014'
class FDWTooManyHandlesError(FDWError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,574
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.FDWTableNotFoundError
class FDWTableNotFoundError(FDWError): sqlstate = 'HV00R'
class FDWTableNotFoundError(FDWError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,575
MagicStack/asyncpg
MagicStack_asyncpg/tests/test_timeout.py
tests.test_timeout.SlowPrepareConnection
class SlowPrepareConnection(pg_connection.Connection): """Connection class to test timeouts.""" async def _get_statement(self, query, timeout, **kwargs): await asyncio.sleep(0.3) return await super()._get_statement(query, timeout, **kwargs)
class SlowPrepareConnection(pg_connection.Connection): '''Connection class to test timeouts.''' async def _get_statement(self, query, timeout, **kwargs): pass
2
1
3
0
3
0
1
0.25
1
1
0
0
1
0
1
87
5
0
4
2
2
1
4
2
2
1
4
0
1
148,576
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/pool.py
asyncpg.pool.Pool
class Pool: """A connection pool. Connection pool can be used to manage a set of connections to the database. Connections are first acquired from the pool, then used, and then released back to the pool. Once a connection is released, it's reset to close all open cursors and other resources *except* prepared statements. Pools are created by calling :func:`~asyncpg.pool.create_pool`. """ __slots__ = ( '_queue', '_loop', '_minsize', '_maxsize', '_init', '_connect', '_reset', '_connect_args', '_connect_kwargs', '_holders', '_initialized', '_initializing', '_closing', '_closed', '_connection_class', '_record_class', '_generation', '_setup', '_max_queries', '_max_inactive_connection_lifetime' ) def __init__(self, *connect_args, min_size, max_size, max_queries, max_inactive_connection_lifetime, connect=None, setup=None, init=None, reset=None, loop, connection_class, record_class, **connect_kwargs): if len(connect_args) > 1: warnings.warn( "Passing multiple positional arguments to asyncpg.Pool " "constructor is deprecated and will be removed in " "asyncpg 0.17.0. The non-deprecated form is " "asyncpg.Pool(<dsn>, **kwargs)", DeprecationWarning, stacklevel=2) if loop is None: loop = asyncio.get_event_loop() self._loop = loop if max_size <= 0: raise ValueError('max_size is expected to be greater than zero') if min_size < 0: raise ValueError( 'min_size is expected to be greater or equal to zero') if min_size > max_size: raise ValueError('min_size is greater than max_size') if max_queries <= 0: raise ValueError('max_queries is expected to be greater than zero') if max_inactive_connection_lifetime < 0: raise ValueError( 'max_inactive_connection_lifetime is expected to be greater ' 'or equal to zero') if not issubclass(connection_class, connection.Connection): raise TypeError( 'connection_class is expected to be a subclass of ' 'asyncpg.Connection, got {!r}'.format(connection_class)) if not issubclass(record_class, protocol.Record): raise TypeError( 'record_class is expected to be a subclass of ' 'asyncpg.Record, got {!r}'.format(record_class)) self._minsize = min_size self._maxsize = max_size self._holders = [] self._initialized = False self._initializing = False self._queue = None self._connection_class = connection_class self._record_class = record_class self._closing = False self._closed = False self._generation = 0 self._connect = connect if connect is not None else connection.connect self._connect_args = connect_args self._connect_kwargs = connect_kwargs self._setup = setup self._init = init self._reset = reset self._max_queries = max_queries self._max_inactive_connection_lifetime = \ max_inactive_connection_lifetime async def _async__init__(self): if self._initialized: return self if self._initializing: raise exceptions.InterfaceError( 'pool is being initialized in another task') if self._closed: raise exceptions.InterfaceError('pool is closed') self._initializing = True try: await self._initialize() return self finally: self._initializing = False self._initialized = True async def _initialize(self): self._queue = asyncio.LifoQueue(maxsize=self._maxsize) for _ in range(self._maxsize): ch = PoolConnectionHolder( self, max_queries=self._max_queries, max_inactive_time=self._max_inactive_connection_lifetime, setup=self._setup) self._holders.append(ch) self._queue.put_nowait(ch) if self._minsize: # Since we use a LIFO queue, the first items in the queue will be # the last ones in `self._holders`. We want to pre-connect the # first few connections in the queue, therefore we want to walk # `self._holders` in reverse. # Connect the first connection holder in the queue so that # any connection issues are visible early. first_ch = self._holders[-1] # type: PoolConnectionHolder await first_ch.connect() if self._minsize > 1: connect_tasks = [] for i, ch in enumerate(reversed(self._holders[:-1])): # `minsize - 1` because we already have first_ch if i >= self._minsize - 1: break connect_tasks.append(ch.connect()) await asyncio.gather(*connect_tasks) def is_closing(self): """Return ``True`` if the pool is closing or is closed. .. versionadded:: 0.28.0 """ return self._closed or self._closing def get_size(self): """Return the current number of connections in this pool. .. versionadded:: 0.25.0 """ return sum(h.is_connected() for h in self._holders) def get_min_size(self): """Return the minimum number of connections in this pool. .. versionadded:: 0.25.0 """ return self._minsize def get_max_size(self): """Return the maximum allowed number of connections in this pool. .. versionadded:: 0.25.0 """ return self._maxsize def get_idle_size(self): """Return the current number of idle connections in this pool. .. versionadded:: 0.25.0 """ return sum(h.is_connected() and h.is_idle() for h in self._holders) def set_connect_args(self, dsn=None, **connect_kwargs): r"""Set the new connection arguments for this pool. The new connection arguments will be used for all subsequent new connection attempts. Existing connections will remain until they expire. Use :meth:`Pool.expire_connections() <asyncpg.pool.Pool.expire_connections>` to expedite the connection expiry. :param str dsn: Connection arguments specified using as a single string in the following format: ``postgres://user:pass@host:port/database?option=value``. :param \*\*connect_kwargs: Keyword arguments for the :func:`~asyncpg.connection.connect` function. .. versionadded:: 0.16.0 """ self._connect_args = [dsn] self._connect_kwargs = connect_kwargs async def _get_new_connection(self): con = await self._connect( *self._connect_args, loop=self._loop, connection_class=self._connection_class, record_class=self._record_class, **self._connect_kwargs, ) if not isinstance(con, self._connection_class): good = self._connection_class good_n = f'{good.__module__}.{good.__name__}' bad = type(con) if bad.__module__ == "builtins": bad_n = bad.__name__ else: bad_n = f'{bad.__module__}.{bad.__name__}' raise exceptions.InterfaceError( "expected pool connect callback to return an instance of " f"'{good_n}', got " f"'{bad_n}'" ) if self._init is not None: try: await self._init(con) except (Exception, asyncio.CancelledError) as ex: # If a user-defined `init` function fails, we don't # know if the connection is safe for re-use, hence # we close it. A new connection will be created # when `acquire` is called again. try: # Use `close()` to close the connection gracefully. # An exception in `init` isn't necessarily caused # by an IO or a protocol error. close() will # do the necessary cleanup via _release_on_close(). await con.close() finally: raise ex return con async def execute(self, query: str, *args, timeout: float=None) -> str: """Execute an SQL command (or commands). Pool performs this operation using one of its connections. Other than that, it behaves identically to :meth:`Connection.execute() <asyncpg.connection.Connection.execute>`. .. versionadded:: 0.10.0 """ async with self.acquire() as con: return await con.execute(query, *args, timeout=timeout) async def executemany(self, command: str, args, *, timeout: float=None): """Execute an SQL *command* for each sequence of arguments in *args*. Pool performs this operation using one of its connections. Other than that, it behaves identically to :meth:`Connection.executemany() <asyncpg.connection.Connection.executemany>`. .. versionadded:: 0.10.0 """ async with self.acquire() as con: return await con.executemany(command, args, timeout=timeout) async def fetch( self, query, *args, timeout=None, record_class=None ) -> list: """Run a query and return the results as a list of :class:`Record`. Pool performs this operation using one of its connections. Other than that, it behaves identically to :meth:`Connection.fetch() <asyncpg.connection.Connection.fetch>`. .. versionadded:: 0.10.0 """ async with self.acquire() as con: return await con.fetch( query, *args, timeout=timeout, record_class=record_class ) async def fetchval(self, query, *args, column=0, timeout=None): """Run a query and return a value in the first row. Pool performs this operation using one of its connections. Other than that, it behaves identically to :meth:`Connection.fetchval() <asyncpg.connection.Connection.fetchval>`. .. versionadded:: 0.10.0 """ async with self.acquire() as con: return await con.fetchval( query, *args, column=column, timeout=timeout) async def fetchrow(self, query, *args, timeout=None, record_class=None): """Run a query and return the first row. Pool performs this operation using one of its connections. Other than that, it behaves identically to :meth:`Connection.fetchrow() <asyncpg.connection.Connection.fetchrow>`. .. versionadded:: 0.10.0 """ async with self.acquire() as con: return await con.fetchrow( query, *args, timeout=timeout, record_class=record_class ) async def fetchmany(self, query, args, *, timeout=None, record_class=None): """Run a query for each sequence of arguments in *args* and return the results as a list of :class:`Record`. Pool performs this operation using one of its connections. Other than that, it behaves identically to :meth:`Connection.fetchmany() <asyncpg.connection.Connection.fetchmany>`. .. versionadded:: 0.30.0 """ async with self.acquire() as con: return await con.fetchmany( query, args, timeout=timeout, record_class=record_class ) async def copy_from_table( self, table_name, *, output, columns=None, schema_name=None, timeout=None, format=None, oids=None, delimiter=None, null=None, header=None, quote=None, escape=None, force_quote=None, encoding=None ): """Copy table contents to a file or file-like object. Pool performs this operation using one of its connections. Other than that, it behaves identically to :meth:`Connection.copy_from_table() <asyncpg.connection.Connection.copy_from_table>`. .. versionadded:: 0.24.0 """ async with self.acquire() as con: return await con.copy_from_table( table_name, output=output, columns=columns, schema_name=schema_name, timeout=timeout, format=format, oids=oids, delimiter=delimiter, null=null, header=header, quote=quote, escape=escape, force_quote=force_quote, encoding=encoding ) async def copy_from_query( self, query, *args, output, timeout=None, format=None, oids=None, delimiter=None, null=None, header=None, quote=None, escape=None, force_quote=None, encoding=None ): """Copy the results of a query to a file or file-like object. Pool performs this operation using one of its connections. Other than that, it behaves identically to :meth:`Connection.copy_from_query() <asyncpg.connection.Connection.copy_from_query>`. .. versionadded:: 0.24.0 """ async with self.acquire() as con: return await con.copy_from_query( query, *args, output=output, timeout=timeout, format=format, oids=oids, delimiter=delimiter, null=null, header=header, quote=quote, escape=escape, force_quote=force_quote, encoding=encoding ) async def copy_to_table( self, table_name, *, source, columns=None, schema_name=None, timeout=None, format=None, oids=None, freeze=None, delimiter=None, null=None, header=None, quote=None, escape=None, force_quote=None, force_not_null=None, force_null=None, encoding=None, where=None ): """Copy data to the specified table. Pool performs this operation using one of its connections. Other than that, it behaves identically to :meth:`Connection.copy_to_table() <asyncpg.connection.Connection.copy_to_table>`. .. versionadded:: 0.24.0 """ async with self.acquire() as con: return await con.copy_to_table( table_name, source=source, columns=columns, schema_name=schema_name, timeout=timeout, format=format, oids=oids, freeze=freeze, delimiter=delimiter, null=null, header=header, quote=quote, escape=escape, force_quote=force_quote, force_not_null=force_not_null, force_null=force_null, encoding=encoding, where=where ) async def copy_records_to_table( self, table_name, *, records, columns=None, schema_name=None, timeout=None, where=None ): """Copy a list of records to the specified table using binary COPY. Pool performs this operation using one of its connections. Other than that, it behaves identically to :meth:`Connection.copy_records_to_table() <asyncpg.connection.Connection.copy_records_to_table>`. .. versionadded:: 0.24.0 """ async with self.acquire() as con: return await con.copy_records_to_table( table_name, records=records, columns=columns, schema_name=schema_name, timeout=timeout, where=where ) def acquire(self, *, timeout=None): """Acquire a database connection from the pool. :param float timeout: A timeout for acquiring a Connection. :return: An instance of :class:`~asyncpg.connection.Connection`. Can be used in an ``await`` expression or with an ``async with`` block. .. code-block:: python async with pool.acquire() as con: await con.execute(...) Or: .. code-block:: python con = await pool.acquire() try: await con.execute(...) finally: await pool.release(con) """ return PoolAcquireContext(self, timeout) async def _acquire(self, timeout): async def _acquire_impl(): ch = await self._queue.get() # type: PoolConnectionHolder try: proxy = await ch.acquire() # type: PoolConnectionProxy except (Exception, asyncio.CancelledError): self._queue.put_nowait(ch) raise else: # Record the timeout, as we will apply it by default # in release(). ch._timeout = timeout return proxy if self._closing: raise exceptions.InterfaceError('pool is closing') self._check_init() if timeout is None: return await _acquire_impl() else: return await compat.wait_for( _acquire_impl(), timeout=timeout) async def release(self, connection, *, timeout=None): """Release a database connection back to the pool. :param Connection connection: A :class:`~asyncpg.connection.Connection` object to release. :param float timeout: A timeout for releasing the connection. If not specified, defaults to the timeout provided in the corresponding call to the :meth:`Pool.acquire() <asyncpg.pool.Pool.acquire>` method. .. versionchanged:: 0.14.0 Added the *timeout* parameter. """ if (type(connection) is not PoolConnectionProxy or connection._holder._pool is not self): raise exceptions.InterfaceError( 'Pool.release() received invalid connection: ' '{connection!r} is not a member of this pool'.format( connection=connection)) if connection._con is None: # Already released, do nothing. return self._check_init() # Let the connection do its internal housekeeping when its released. connection._con._on_release() ch = connection._holder if timeout is None: timeout = ch._timeout # Use asyncio.shield() to guarantee that task cancellation # does not prevent the connection from being returned to the # pool properly. return await asyncio.shield(ch.release(timeout)) async def close(self): """Attempt to gracefully close all connections in the pool. Wait until all pool connections are released, close them and shut down the pool. If any error (including cancellation) occurs in ``close()`` the pool will terminate by calling :meth:`Pool.terminate() <pool.Pool.terminate>`. It is advisable to use :func:`python:asyncio.wait_for` to set a timeout. .. versionchanged:: 0.16.0 ``close()`` now waits until all pool connections are released before closing them and the pool. Errors raised in ``close()`` will cause immediate pool termination. """ if self._closed: return self._check_init() self._closing = True warning_callback = None try: warning_callback = self._loop.call_later( 60, self._warn_on_long_close) release_coros = [ ch.wait_until_released() for ch in self._holders] await asyncio.gather(*release_coros) close_coros = [ ch.close() for ch in self._holders] await asyncio.gather(*close_coros) except (Exception, asyncio.CancelledError): self.terminate() raise finally: if warning_callback is not None: warning_callback.cancel() self._closed = True self._closing = False def _warn_on_long_close(self): logger.warning('Pool.close() is taking over 60 seconds to complete. ' 'Check if you have any unreleased connections left. ' 'Use asyncio.wait_for() to set a timeout for ' 'Pool.close().') def terminate(self): """Terminate all connections in the pool.""" if self._closed: return self._check_init() for ch in self._holders: ch.terminate() self._closed = True async def expire_connections(self): """Expire all currently open connections. Cause all currently open connections to get replaced on the next :meth:`~asyncpg.pool.Pool.acquire()` call. .. versionadded:: 0.16.0 """ self._generation += 1 def _check_init(self): if not self._initialized: if self._initializing: raise exceptions.InterfaceError( 'pool is being initialized, but not yet ready: ' 'likely there is a race between creating a pool and ' 'using it') raise exceptions.InterfaceError('pool is not initialized') if self._closed: raise exceptions.InterfaceError('pool is closed') def _drop_statement_cache(self): # Drop statement cache for all connections in the pool. for ch in self._holders: if ch._con is not None: ch._con._drop_local_statement_cache() def _drop_type_cache(self): # Drop type codec cache for all connections in the pool. for ch in self._holders: if ch._con is not None: ch._con._drop_local_type_cache() def __await__(self): return self._async__init__().__await__() async def __aenter__(self): await self._async__init__() return self async def __aexit__(self, *exc): await self.close()
class Pool: '''A connection pool. Connection pool can be used to manage a set of connections to the database. Connections are first acquired from the pool, then used, and then released back to the pool. Once a connection is released, it's reset to close all open cursors and other resources *except* prepared statements. Pools are created by calling :func:`~asyncpg.pool.create_pool`. ''' def __init__(self, *connect_args, min_size, max_size, max_queries, max_inactive_connection_lifetime, connect=None, setup=None, init=None, reset=None, loop, connection_class, record_class, **connect_kwargs): pass async def _async__init__(self): pass async def _initialize(self): pass def is_closing(self): '''Return ``True`` if the pool is closing or is closed. .. versionadded:: 0.28.0 ''' pass def get_size(self): '''Return the current number of connections in this pool. .. versionadded:: 0.25.0 ''' pass def get_min_size(self): '''Return the minimum number of connections in this pool. .. versionadded:: 0.25.0 ''' pass def get_max_size(self): '''Return the maximum allowed number of connections in this pool. .. versionadded:: 0.25.0 ''' pass def get_idle_size(self): '''Return the current number of idle connections in this pool. .. versionadded:: 0.25.0 ''' pass def set_connect_args(self, dsn=None, **connect_kwargs): '''Set the new connection arguments for this pool. The new connection arguments will be used for all subsequent new connection attempts. Existing connections will remain until they expire. Use :meth:`Pool.expire_connections() <asyncpg.pool.Pool.expire_connections>` to expedite the connection expiry. :param str dsn: Connection arguments specified using as a single string in the following format: ``postgres://user:pass@host:port/database?option=value``. :param \*\*connect_kwargs: Keyword arguments for the :func:`~asyncpg.connection.connect` function. .. versionadded:: 0.16.0 ''' pass async def _get_new_connection(self): pass async def execute(self, query: str, *args, timeout: float=None) -> str: '''Execute an SQL command (or commands). Pool performs this operation using one of its connections. Other than that, it behaves identically to :meth:`Connection.execute() <asyncpg.connection.Connection.execute>`. .. versionadded:: 0.10.0 ''' pass async def executemany(self, command: str, args, *, timeout: float=None): '''Execute an SQL *command* for each sequence of arguments in *args*. Pool performs this operation using one of its connections. Other than that, it behaves identically to :meth:`Connection.executemany() <asyncpg.connection.Connection.executemany>`. .. versionadded:: 0.10.0 ''' pass async def fetch( self, query, *args, timeout=None, record_class=None ) -> list: '''Run a query and return the results as a list of :class:`Record`. Pool performs this operation using one of its connections. Other than that, it behaves identically to :meth:`Connection.fetch() <asyncpg.connection.Connection.fetch>`. .. versionadded:: 0.10.0 ''' pass async def fetchval(self, query, *args, column=0, timeout=None): '''Run a query and return a value in the first row. Pool performs this operation using one of its connections. Other than that, it behaves identically to :meth:`Connection.fetchval() <asyncpg.connection.Connection.fetchval>`. .. versionadded:: 0.10.0 ''' pass async def fetchrow(self, query, *args, timeout=None, record_class=None): '''Run a query and return the first row. Pool performs this operation using one of its connections. Other than that, it behaves identically to :meth:`Connection.fetchrow() <asyncpg.connection.Connection.fetchrow>`. .. versionadded:: 0.10.0 ''' pass async def fetchmany(self, query, args, *, timeout=None, record_class=None): '''Run a query for each sequence of arguments in *args* and return the results as a list of :class:`Record`. Pool performs this operation using one of its connections. Other than that, it behaves identically to :meth:`Connection.fetchmany() <asyncpg.connection.Connection.fetchmany>`. .. versionadded:: 0.30.0 ''' pass async def copy_from_table( self, table_name, *, output, columns=None, schema_name=None, timeout=None, format=None, oids=None, delimiter=None, null=None, header=None, quote=None, escape=None, force_quote=None, encoding=None ): '''Copy table contents to a file or file-like object. Pool performs this operation using one of its connections. Other than that, it behaves identically to :meth:`Connection.copy_from_table() <asyncpg.connection.Connection.copy_from_table>`. .. versionadded:: 0.24.0 ''' pass async def copy_from_query( self, query, *args, output, timeout=None, format=None, oids=None, delimiter=None, null=None, header=None, quote=None, escape=None, force_quote=None, encoding=None ): '''Copy the results of a query to a file or file-like object. Pool performs this operation using one of its connections. Other than that, it behaves identically to :meth:`Connection.copy_from_query() <asyncpg.connection.Connection.copy_from_query>`. .. versionadded:: 0.24.0 ''' pass async def copy_to_table( self, table_name, *, source, columns=None, schema_name=None, timeout=None, format=None, oids=None, freeze=None, delimiter=None, null=None, header=None, quote=None, escape=None, force_quote=None, force_not_null=None, force_null=None, encoding=None, where=None ): '''Copy data to the specified table. Pool performs this operation using one of its connections. Other than that, it behaves identically to :meth:`Connection.copy_to_table() <asyncpg.connection.Connection.copy_to_table>`. .. versionadded:: 0.24.0 ''' pass async def copy_records_to_table( self, table_name, *, records, columns=None, schema_name=None, timeout=None, where=None ): '''Copy a list of records to the specified table using binary COPY. Pool performs this operation using one of its connections. Other than that, it behaves identically to :meth:`Connection.copy_records_to_table() <asyncpg.connection.Connection.copy_records_to_table>`. .. versionadded:: 0.24.0 ''' pass def acquire(self, *, timeout=None): '''Acquire a database connection from the pool. :param float timeout: A timeout for acquiring a Connection. :return: An instance of :class:`~asyncpg.connection.Connection`. Can be used in an ``await`` expression or with an ``async with`` block. .. code-block:: python async with pool.acquire() as con: await con.execute(...) Or: .. code-block:: python con = await pool.acquire() try: await con.execute(...) finally: await pool.release(con) ''' pass async def _acquire(self, timeout): pass async def _acquire_impl(): pass async def release(self, connection, *, timeout=None): '''Release a database connection back to the pool. :param Connection connection: A :class:`~asyncpg.connection.Connection` object to release. :param float timeout: A timeout for releasing the connection. If not specified, defaults to the timeout provided in the corresponding call to the :meth:`Pool.acquire() <asyncpg.pool.Pool.acquire>` method. .. versionchanged:: 0.14.0 Added the *timeout* parameter. ''' pass async def close(self): '''Attempt to gracefully close all connections in the pool. Wait until all pool connections are released, close them and shut down the pool. If any error (including cancellation) occurs in ``close()`` the pool will terminate by calling :meth:`Pool.terminate() <pool.Pool.terminate>`. It is advisable to use :func:`python:asyncio.wait_for` to set a timeout. .. versionchanged:: 0.16.0 ``close()`` now waits until all pool connections are released before closing them and the pool. Errors raised in ``close()`` will cause immediate pool termination. ''' pass def _warn_on_long_close(self): pass def terminate(self): '''Terminate all connections in the pool.''' pass async def expire_connections(self): '''Expire all currently open connections. Cause all currently open connections to get replaced on the next :meth:`~asyncpg.pool.Pool.acquire()` call. .. versionadded:: 0.16.0 ''' pass def _check_init(self): pass def _drop_statement_cache(self): pass def _drop_type_cache(self): pass def __await__(self): pass async def __aenter__(self): pass async def __aexit__(self, *exc): pass
35
22
19
2
12
5
2
0.42
0
15
4
0
33
20
33
33
701
116
413
166
298
175
213
75
178
11
0
4
74
148,577
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/_base.py
asyncpg.exceptions._base.UnsupportedServerFeatureError
class UnsupportedServerFeatureError(InterfaceError): """Requested feature is unsupported by PostgreSQL server."""
class UnsupportedServerFeatureError(InterfaceError): '''Requested feature is unsupported by PostgreSQL server.''' pass
1
1
0
0
0
0
0
1
1
0
0
0
0
0
0
14
2
0
1
1
0
1
1
1
0
0
4
0
0
148,578
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/_base.py
asyncpg.exceptions._base.UnsupportedClientFeatureError
class UnsupportedClientFeatureError(InterfaceError): """Requested feature is unsupported by asyncpg."""
class UnsupportedClientFeatureError(InterfaceError): '''Requested feature is unsupported by asyncpg.''' pass
1
1
0
0
0
0
0
1
1
0
0
0
0
0
0
14
2
0
1
1
0
1
1
1
0
0
4
0
0
148,579
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/_base.py
asyncpg.exceptions._base.UnknownPostgresError
class UnknownPostgresError(FatalPostgresError): """An error with an unknown SQLSTATE code."""
class UnknownPostgresError(FatalPostgresError): '''An error with an unknown SQLSTATE code.''' pass
1
1
0
0
0
0
0
1
1
0
0
0
0
0
0
31
2
0
1
1
0
1
1
1
0
0
6
0
0
148,580
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/_base.py
asyncpg.exceptions._base.TargetServerAttributeNotMatched
class TargetServerAttributeNotMatched(InternalClientError): """Could not find a host that satisfies the target attribute requirement"""
class TargetServerAttributeNotMatched(InternalClientError): '''Could not find a host that satisfies the target attribute requirement''' pass
1
1
0
0
0
0
0
1
1
0
0
0
0
0
0
10
2
0
1
1
0
1
1
1
0
0
4
0
0
148,581
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/_base.py
asyncpg.exceptions._base.ProtocolError
class ProtocolError(InternalClientError): """Unexpected condition in the handling of PostgreSQL protocol input."""
class ProtocolError(InternalClientError): '''Unexpected condition in the handling of PostgreSQL protocol input.''' pass
1
1
0
0
0
0
0
1
1
0
0
0
0
0
0
10
2
0
1
1
0
1
1
1
0
0
4
0
0
148,582
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/_base.py
asyncpg.exceptions._base.PostgresMessageMeta
class PostgresMessageMeta(type): _message_map = {} _field_map = { 'S': 'severity', 'V': 'severity_en', 'C': 'sqlstate', 'M': 'message', 'D': 'detail', 'H': 'hint', 'P': 'position', 'p': 'internal_position', 'q': 'internal_query', 'W': 'context', 's': 'schema_name', 't': 'table_name', 'c': 'column_name', 'd': 'data_type_name', 'n': 'constraint_name', 'F': 'server_source_filename', 'L': 'server_source_line', 'R': 'server_source_function' } def __new__(mcls, name, bases, dct): cls = super().__new__(mcls, name, bases, dct) if cls.__module__ == mcls.__module__ and name == 'PostgresMessage': for f in mcls._field_map.values(): setattr(cls, f, None) if _is_asyncpg_class(cls): mod = sys.modules[cls.__module__] if hasattr(mod, name): raise RuntimeError('exception class redefinition: {}'.format( name)) code = dct.get('sqlstate') if code is not None: existing = mcls._message_map.get(code) if existing is not None: raise TypeError('{} has duplicate SQLSTATE code, which is' 'already defined by {}'.format( name, existing.__name__)) mcls._message_map[code] = cls return cls @classmethod def get_message_class_for_sqlstate(mcls, code): return mcls._message_map.get(code, UnknownPostgresError)
class PostgresMessageMeta(type): def __new__(mcls, name, bases, dct): pass @classmethod def get_message_class_for_sqlstate(mcls, code): pass
4
0
12
2
11
0
4
0
1
4
1
1
1
0
2
15
50
6
44
11
40
0
21
10
18
7
2
2
8
148,583
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/_base.py
asyncpg.exceptions._base.PostgresMessage
class PostgresMessage(metaclass=PostgresMessageMeta): @classmethod def _get_error_class(cls, fields): sqlstate = fields.get('C') return type(cls).get_message_class_for_sqlstate(sqlstate) @classmethod def _get_error_dict(cls, fields, query): dct = { 'query': query } field_map = type(cls)._field_map for k, v in fields.items(): field = field_map.get(k) if field: dct[field] = v return dct @classmethod def _make_constructor(cls, fields, query=None): dct = cls._get_error_dict(fields, query) exccls = cls._get_error_class(fields) message = dct.get('message', '') # PostgreSQL will raise an exception when it detects # that the result type of the query has changed from # when the statement was prepared. # # The original error is somewhat cryptic and unspecific, # so we raise a custom subclass that is easier to handle # and identify. # # Note that we specifically do not rely on the error # message, as it is localizable. is_icse = ( exccls.__name__ == 'FeatureNotSupportedError' and _is_asyncpg_class(exccls) and dct.get('server_source_function') == 'RevalidateCachedQuery' ) if is_icse: exceptions = sys.modules[exccls.__module__] exccls = exceptions.InvalidCachedStatementError message = ('cached statement plan is invalid due to a database ' 'schema or configuration change') is_prepared_stmt_error = ( exccls.__name__ in ('DuplicatePreparedStatementError', 'InvalidSQLStatementNameError') and _is_asyncpg_class(exccls) ) if is_prepared_stmt_error: hint = dct.get('hint', '') hint += textwrap.dedent("""\ NOTE: pgbouncer with pool_mode set to "transaction" or "statement" does not support prepared statements properly. You have two options: * if you are using pgbouncer for connection pooling to a single server, switch to the connection pool functionality provided by asyncpg, it is a much better option for this purpose; * if you have no option of avoiding the use of pgbouncer, then you can set statement_cache_size to 0 when creating the asyncpg connection object. """) dct['hint'] = hint return exccls, message, dct def as_dict(self): dct = {} for f in type(self)._field_map.values(): val = getattr(self, f) if val is not None: dct[f] = val return dct
class PostgresMessage(metaclass=PostgresMessageMeta): @classmethod def _get_error_class(cls, fields): pass @classmethod def _get_error_dict(cls, fields, query): pass @classmethod def _make_constructor(cls, fields, query=None): pass def as_dict(self): pass
8
0
19
3
14
3
3
0.17
1
0
0
2
1
0
4
19
85
16
59
23
51
10
34
20
29
3
3
2
10
148,584
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/_base.py
asyncpg.exceptions._base.PostgresLogMessage
class PostgresLogMessage(PostgresMessage): """A base class for non-error server messages.""" def __str__(self): return '{}: {}'.format(type(self).__name__, self.message) def __setattr__(self, name, val): raise TypeError('instances of {} are immutable'.format( type(self).__name__)) @classmethod def new(cls, fields, query=None): exccls, message_text, dct = cls._make_constructor(fields, query) if exccls is UnknownPostgresError: exccls = PostgresLogMessage if exccls is PostgresLogMessage: severity = dct.get('severity_en') or dct.get('severity') if severity and severity.upper() == 'WARNING': exccls = asyncpg.PostgresWarning if issubclass(exccls, (BaseException, Warning)): msg = exccls(message_text) else: msg = exccls() msg.__dict__.update(dct) return msg
class PostgresLogMessage(PostgresMessage): '''A base class for non-error server messages.''' def __str__(self): pass def __setattr__(self, name, val): pass @classmethod def new(cls, fields, query=None): pass
5
1
8
1
6
0
2
0.05
1
4
1
1
2
0
3
22
29
7
21
8
16
1
18
7
14
5
4
2
7
148,585
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/_base.py
asyncpg.exceptions._base.PostgresError
class PostgresError(PostgresMessage, Exception): """Base class for all Postgres errors.""" def __str__(self): msg = self.args[0] if self.detail: msg += '\nDETAIL: {}'.format(self.detail) if self.hint: msg += '\nHINT: {}'.format(self.hint) return msg @classmethod def new(cls, fields, query=None): exccls, message, dct = cls._make_constructor(fields, query) ex = exccls(message) ex.__dict__.update(dct) return ex
class PostgresError(PostgresMessage, Exception): '''Base class for all Postgres errors.''' def __str__(self): pass @classmethod def new(cls, fields, query=None): pass
4
1
7
1
6
0
2
0.07
2
0
0
42
1
0
2
31
18
3
14
7
10
1
13
6
10
3
4
1
4
148,586
MagicStack/asyncpg
MagicStack_asyncpg/tests/test_record.py
tests.test_record.CustomRecord
class CustomRecord(asyncpg.Record): pass
class CustomRecord(asyncpg.Record): pass
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
0
2
1
1
0
2
1
1
0
0
0
0
148,587
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/_base.py
asyncpg.exceptions._base.OutdatedSchemaCacheError
class OutdatedSchemaCacheError(InternalClientError): """A value decoding error caused by a schema change before row fetching.""" def __init__(self, msg, *, schema=None, data_type=None, position=None): super().__init__(msg) self.schema_name = schema self.data_type_name = data_type self.position = position
class OutdatedSchemaCacheError(InternalClientError): '''A value decoding error caused by a schema change before row fetching.''' def __init__(self, msg, *, schema=None, data_type=None, position=None): pass
2
1
5
0
5
0
1
0.17
1
1
0
0
1
3
1
11
8
1
6
5
4
1
6
5
4
1
4
0
1
148,588
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/_base.py
asyncpg.exceptions._base.InterfaceWarning
class InterfaceWarning(InterfaceMessage, UserWarning): """A warning caused by an improper use of asyncpg API.""" def __init__(self, msg, *, detail=None, hint=None): InterfaceMessage.__init__(self, detail=detail, hint=hint) UserWarning.__init__(self, msg)
class InterfaceWarning(InterfaceMessage, UserWarning): '''A warning caused by an improper use of asyncpg API.''' def __init__(self, msg, *, detail=None, hint=None): pass
2
1
3
0
3
0
1
0.25
2
0
0
0
1
0
1
15
6
1
4
2
2
1
4
2
2
1
5
0
1
148,589
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/_base.py
asyncpg.exceptions._base.InterfaceMessage
class InterfaceMessage: def __init__(self, *, detail=None, hint=None): self.detail = detail self.hint = hint def __str__(self): msg = self.args[0] if self.detail: msg += '\nDETAIL: {}'.format(self.detail) if self.hint: msg += '\nHINT: {}'.format(self.hint) return msg
class InterfaceMessage: def __init__(self, *, detail=None, hint=None): pass def __str__(self): pass
3
0
6
1
5
0
2
0
0
0
0
2
2
2
2
2
13
2
11
6
8
0
11
6
8
3
0
1
4
148,590
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/_base.py
asyncpg.exceptions._base.InterfaceError
class InterfaceError(InterfaceMessage, Exception): """An error caused by improper use of asyncpg API.""" def __init__(self, msg, *, detail=None, hint=None): InterfaceMessage.__init__(self, detail=detail, hint=hint) Exception.__init__(self, msg) def with_msg(self, msg): return type(self)( msg, detail=self.detail, hint=self.hint, ).with_traceback( self.__traceback__ )
class InterfaceError(InterfaceMessage, Exception): '''An error caused by improper use of asyncpg API.''' def __init__(self, msg, *, detail=None, hint=None): pass def with_msg(self, msg): pass
3
1
6
0
6
0
1
0.08
2
1
0
4
2
1
2
14
15
2
12
4
9
1
6
3
3
1
3
0
2
148,591
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/_base.py
asyncpg.exceptions._base.FatalPostgresError
class FatalPostgresError(PostgresError): """A fatal error that should result in server disconnection."""
class FatalPostgresError(PostgresError): '''A fatal error that should result in server disconnection.''' pass
1
1
0
0
0
0
0
1
1
0
0
1
0
0
0
31
2
0
1
1
0
1
1
1
0
0
5
0
0
148,592
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/_base.py
asyncpg.exceptions._base.DataError
class DataError(InterfaceError, ValueError): """An error caused by invalid query input."""
class DataError(InterfaceError, ValueError): '''An error caused by invalid query input.''' pass
1
1
0
0
0
0
0
1
2
0
0
0
0
0
0
15
2
0
1
1
0
1
1
1
0
0
4
0
0
148,593
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/_base.py
asyncpg.exceptions._base.ClientConfigurationError
class ClientConfigurationError(InterfaceError, ValueError): """An error caused by improper client configuration."""
class ClientConfigurationError(InterfaceError, ValueError): '''An error caused by improper client configuration.''' pass
1
1
0
0
0
0
0
1
2
0
0
0
0
0
0
15
2
0
1
1
0
1
1
1
0
0
4
0
0
148,594
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.ZeroLengthCharacterStringError
class ZeroLengthCharacterStringError(DataError): sqlstate = '2200F'
class ZeroLengthCharacterStringError(DataError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,595
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.WrongObjectTypeError
class WrongObjectTypeError(SyntaxOrAccessError): sqlstate = '42809'
class WrongObjectTypeError(SyntaxOrAccessError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,596
MagicStack/asyncpg
MagicStack_asyncpg/tests/test_test.py
tests.test_test.TestHelpers
class TestHelpers(tb.TestCase): async def test_tests_assertLoopErrorHandlerCalled_01(self): with self.assertRaisesRegex(AssertionError, r'no message.*was logged'): with self.assertLoopErrorHandlerCalled('aa'): self.loop.call_exception_handler({'message': 'bb a bb'}) with self.assertLoopErrorHandlerCalled('aa'): self.loop.call_exception_handler({'message': 'bbaabb'})
class TestHelpers(tb.TestCase): async def test_tests_assertLoopErrorHandlerCalled_01(self): pass
2
0
7
1
6
0
1
0
1
1
0
0
1
0
1
1
9
2
7
2
5
0
7
2
5
1
1
2
1
148,597
MagicStack/asyncpg
MagicStack_asyncpg/tests/test_test.py
tests.test_test.TestTests
class TestTests(unittest.TestCase): def test_tests_fail_1(self): SimpleTestCase = types.new_class('SimpleTestCase', (BaseSimpleTestCase, tb.TestCase)) suite = unittest.TestSuite() suite.addTest(SimpleTestCase('test_tests_zero_error')) result = unittest.TestResult() suite.run(result) self.assertIn('ZeroDivisionError', result.errors[0][1])
class TestTests(unittest.TestCase): def test_tests_fail_1(self): pass
2
0
11
3
8
0
1
0
1
3
1
0
1
0
1
73
13
4
9
5
7
0
8
5
6
1
2
0
1
148,598
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/_base.py
asyncpg.exceptions._base.InternalClientError
class InternalClientError(Exception): """All unexpected errors not classified otherwise."""
class InternalClientError(Exception): '''All unexpected errors not classified otherwise.''' pass
1
1
0
0
0
0
0
1
1
0
0
3
0
0
0
10
2
0
1
1
0
1
1
1
0
0
3
0
0
148,599
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.PostgresFloatingPointError
class PostgresFloatingPointError(DataError): sqlstate = '22P01'
class PostgresFloatingPointError(DataError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,600
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.PostgresIOError
class PostgresIOError(PostgresSystemError): sqlstate = '58030'
class PostgresIOError(PostgresSystemError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,601
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InsufficientResourcesError
class InsufficientResourcesError(_base.PostgresError): sqlstate = '53000'
class InsufficientResourcesError(_base.PostgresError): pass
1
0
0
0
0
0
0
0
1
0
0
4
0
0
0
31
2
0
2
2
1
0
2
2
1
0
5
0
0
148,602
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.DatetimeFieldOverflowError
class DatetimeFieldOverflowError(DataError): sqlstate = '22008'
class DatetimeFieldOverflowError(DataError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,603
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.DatatypeMismatchError
class DatatypeMismatchError(SyntaxOrAccessError): sqlstate = '42804'
class DatatypeMismatchError(SyntaxOrAccessError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,604
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.DatabaseDroppedError
class DatabaseDroppedError(OperatorInterventionError): sqlstate = '57P04'
class DatabaseDroppedError(OperatorInterventionError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,605
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.DataError
class DataError(_base.PostgresError): sqlstate = '22000'
class DataError(_base.PostgresError): pass
1
0
0
0
0
0
0
0
1
0
0
67
0
0
0
31
2
0
2
2
1
0
2
2
1
0
5
0
0
148,606
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.DataCorruptedError
class DataCorruptedError(InternalServerError): sqlstate = 'XX001'
class DataCorruptedError(InternalServerError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,607
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.CrashShutdownError
class CrashShutdownError(OperatorInterventionError): sqlstate = '57P02'
class CrashShutdownError(OperatorInterventionError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,608
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.ContainingSQLNotPermittedError
class ContainingSQLNotPermittedError(ExternalRoutineError): sqlstate = '38001'
class ContainingSQLNotPermittedError(ExternalRoutineError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,609
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.ConnectionRejectionError
class ConnectionRejectionError(PostgresConnectionError): sqlstate = '08004'
class ConnectionRejectionError(PostgresConnectionError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,610
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.ConnectionFailureError
class ConnectionFailureError(PostgresConnectionError): sqlstate = '08006'
class ConnectionFailureError(PostgresConnectionError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,611
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.ConnectionDoesNotExistError
class ConnectionDoesNotExistError(PostgresConnectionError): sqlstate = '08003'
class ConnectionDoesNotExistError(PostgresConnectionError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,612
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.ConfigurationLimitExceededError
class ConfigurationLimitExceededError(InsufficientResourcesError): sqlstate = '53400'
class ConfigurationLimitExceededError(InsufficientResourcesError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,613
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.ConfigFileError
class ConfigFileError(_base.PostgresError): sqlstate = 'F0000'
class ConfigFileError(_base.PostgresError): pass
1
0
0
0
0
0
0
0
1
0
0
1
0
0
0
31
2
0
2
2
1
0
2
2
1
0
5
0
0
148,614
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.CollationMismatchError
class CollationMismatchError(SyntaxOrAccessError): sqlstate = '42P21'
class CollationMismatchError(SyntaxOrAccessError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,615
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.ClientCannotConnectError
class ClientCannotConnectError(PostgresConnectionError): sqlstate = '08001'
class ClientCannotConnectError(PostgresConnectionError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,616
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.CheckViolationError
class CheckViolationError(IntegrityConstraintViolationError): sqlstate = '23514'
class CheckViolationError(IntegrityConstraintViolationError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,617
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.CharacterNotInRepertoireError
class CharacterNotInRepertoireError(DataError): sqlstate = '22021'
class CharacterNotInRepertoireError(DataError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,618
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.CaseNotFoundError
class CaseNotFoundError(_base.PostgresError): sqlstate = '20000'
class CaseNotFoundError(_base.PostgresError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
5
0
0
148,619
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.CardinalityViolationError
class CardinalityViolationError(_base.PostgresError): sqlstate = '21000'
class CardinalityViolationError(_base.PostgresError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
5
0
0
148,620
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.CantChangeRuntimeParamError
class CantChangeRuntimeParamError(ObjectNotInPrerequisiteStateError): sqlstate = '55P02'
class CantChangeRuntimeParamError(ObjectNotInPrerequisiteStateError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,621
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.CannotConnectNowError
class CannotConnectNowError(OperatorInterventionError): sqlstate = '57P03'
class CannotConnectNowError(OperatorInterventionError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,622
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.CannotCoerceError
class CannotCoerceError(SyntaxOrAccessError): sqlstate = '42846'
class CannotCoerceError(SyntaxOrAccessError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,623
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.DeadlockDetectedError
class DeadlockDetectedError(TransactionRollbackError): sqlstate = '40P01'
class DeadlockDetectedError(TransactionRollbackError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,624
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.DependentObjectsStillExistError
class DependentObjectsStillExistError( DependentPrivilegeDescriptorsStillExistError): sqlstate = '2BP01'
class DependentObjectsStillExistError( DependentPrivilegeDescriptorsStillExistError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
3
0
3
3
1
0
2
2
1
0
6
0
0
148,625
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.ReadingSQLDataNotPermittedError
class ReadingSQLDataNotPermittedError(SQLRoutineError): sqlstate = '2F004'
class ReadingSQLDataNotPermittedError(SQLRoutineError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,626
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidSchemaDefinitionError
class InvalidSchemaDefinitionError(SyntaxOrAccessError): sqlstate = '42P15'
class InvalidSchemaDefinitionError(SyntaxOrAccessError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,627
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.LockNotAvailableError
class LockNotAvailableError(ObjectNotInPrerequisiteStateError): sqlstate = '55P03'
class LockNotAvailableError(ObjectNotInPrerequisiteStateError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,628
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.LockFileExistsError
class LockFileExistsError(ConfigFileError): sqlstate = 'F0001'
class LockFileExistsError(ConfigFileError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,629
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.LocatorError
class LocatorError(_base.PostgresError): sqlstate = '0F000'
class LocatorError(_base.PostgresError): pass
1
0
0
0
0
0
0
0
1
0
0
1
0
0
0
31
2
0
2
2
1
0
2
2
1
0
5
0
0
148,630
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidXmlProcessingInstructionError
class InvalidXmlProcessingInstructionError(DataError): sqlstate = '2200T'
class InvalidXmlProcessingInstructionError(DataError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,631
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidXmlDocumentError
class InvalidXmlDocumentError(DataError): sqlstate = '2200M'
class InvalidXmlDocumentError(DataError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,632
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidXmlContentError
class InvalidXmlContentError(DataError): sqlstate = '2200N'
class InvalidXmlContentError(DataError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,633
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidXmlCommentError
class InvalidXmlCommentError(DataError): sqlstate = '2200S'
class InvalidXmlCommentError(DataError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,634
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidUseOfEscapeCharacterError
class InvalidUseOfEscapeCharacterError(DataError): sqlstate = '2200C'
class InvalidUseOfEscapeCharacterError(DataError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,635
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidTransactionTerminationError
class InvalidTransactionTerminationError(_base.PostgresError): sqlstate = '2D000'
class InvalidTransactionTerminationError(_base.PostgresError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
5
0
0
148,636
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidTransactionStateError
class InvalidTransactionStateError(_base.PostgresError): sqlstate = '25000'
class InvalidTransactionStateError(_base.PostgresError): pass
1
0
0
0
0
0
0
0
1
0
0
12
0
0
0
31
2
0
2
2
1
0
2
2
1
0
5
0
0
148,637
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.BranchTransactionAlreadyActiveError
class BranchTransactionAlreadyActiveError(InvalidTransactionStateError): sqlstate = '25002'
class BranchTransactionAlreadyActiveError(InvalidTransactionStateError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,638
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidTransactionInitiationError
class InvalidTransactionInitiationError(_base.PostgresError): sqlstate = '0B000'
class InvalidTransactionInitiationError(_base.PostgresError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
5
0
0
148,639
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidTextRepresentationError
class InvalidTextRepresentationError(DataError): sqlstate = '22P02'
class InvalidTextRepresentationError(DataError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,640
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidPreparedStatementDefinitionError
class InvalidPreparedStatementDefinitionError(SyntaxOrAccessError): sqlstate = '42P14'
class InvalidPreparedStatementDefinitionError(SyntaxOrAccessError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,641
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidRecursionError
class InvalidRecursionError(SyntaxOrAccessError): sqlstate = '42P19'
class InvalidRecursionError(SyntaxOrAccessError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,642
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidRegularExpressionError
class InvalidRegularExpressionError(DataError): sqlstate = '2201B'
class InvalidRegularExpressionError(DataError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,643
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidRoleSpecificationError
class InvalidRoleSpecificationError(_base.PostgresError): sqlstate = '0P000'
class InvalidRoleSpecificationError(_base.PostgresError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
5
0
0
148,644
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidRowCountInLimitClauseError
class InvalidRowCountInLimitClauseError(DataError): sqlstate = '2201W'
class InvalidRowCountInLimitClauseError(DataError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,645
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidRowCountInResultOffsetClauseError
class InvalidRowCountInResultOffsetClauseError(DataError): sqlstate = '2201X'
class InvalidRowCountInResultOffsetClauseError(DataError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,646
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidSQLJsonSubscriptError
class InvalidSQLJsonSubscriptError(DataError): sqlstate = '22033'
class InvalidSQLJsonSubscriptError(DataError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
6
0
0
148,647
MagicStack/asyncpg
MagicStack_asyncpg/asyncpg/exceptions/__init__.py
asyncpg.exceptions.InvalidSQLStatementNameError
class InvalidSQLStatementNameError(_base.PostgresError): sqlstate = '26000'
class InvalidSQLStatementNameError(_base.PostgresError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
31
2
0
2
2
1
0
2
2
1
0
5
0
0