| 23 | |
| 24 | |
| 25 | class ConnectionResource: |
| 26 | __slots__ = ('_connection', '_con_release_ctr') |
| 27 | |
| 28 | def __init__(self, connection): |
| 29 | self._connection = connection |
| 30 | self._con_release_ctr = connection._pool_release_ctr |
| 31 | |
| 32 | def _check_conn_validity(self, meth_name): |
| 33 | con_release_ctr = self._connection._pool_release_ctr |
| 34 | if con_release_ctr != self._con_release_ctr: |
| 35 | raise exceptions.InterfaceError( |
| 36 | 'cannot call {}.{}(): ' |
| 37 | 'the underlying connection has been released back ' |
| 38 | 'to the pool'.format(self.__class__.__name__, meth_name)) |
| 39 | |
| 40 | if self._connection.is_closed(): |
| 41 | raise exceptions.InterfaceError( |
| 42 | 'cannot call {}.{}(): ' |
| 43 | 'the underlying connection is closed'.format( |
| 44 | self.__class__.__name__, meth_name)) |
nothing calls this directly
no outgoing calls
no test coverage detected