Skip to content

Commit bb98b79

Browse files
committed
Rename __check_open() -> _check_open()
1 parent 5ddd7fc commit bb98b79

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

asyncpg/connection.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ async def add_listener(self, channel, callback):
118118
**channel**: name of the channel the notification was sent to;
119119
**payload**: the payload.
120120
"""
121-
self.__check_open()
121+
self._check_open()
122122
if channel not in self._listeners:
123123
await self.fetch('LISTEN {}'.format(channel))
124124
self._listeners[channel] = set()
@@ -182,7 +182,7 @@ def transaction(self, *, isolation='read_committed', readonly=False,
182182
.. _`PostgreSQL documentation`: https://www.postgresql.org/docs/\
183183
current/static/sql-set-transaction.html
184184
"""
185-
self.__check_open()
185+
self._check_open()
186186
return transaction.Transaction(self, isolation, readonly, deferrable)
187187

188188
async def execute(self, query: str, *args, timeout: float=None) -> str:
@@ -213,7 +213,7 @@ async def execute(self, query: str, *args, timeout: float=None) -> str:
213213
.. versionchanged:: 0.5.4
214214
Made it possible to pass query arguments.
215215
"""
216-
self.__check_open()
216+
self._check_open()
217217

218218
if not args:
219219
return await self._protocol.query(query, timeout)
@@ -244,7 +244,7 @@ async def executemany(self, command: str, args,
244244
245245
.. versionadded:: 0.7.0
246246
"""
247-
self.__check_open()
247+
self._check_open()
248248

249249
if 'timeout' in kw:
250250
timeout = kw.pop('timeout')
@@ -317,7 +317,7 @@ def cursor(self, query, *args, prefetch=None, timeout=None):
317317
318318
:return: A :class:`~cursor.CursorFactory` object.
319319
"""
320-
self.__check_open()
320+
self._check_open()
321321
return cursor.CursorFactory(self, query, None, args,
322322
prefetch, timeout)
323323

@@ -329,7 +329,7 @@ async def prepare(self, query, *, timeout=None):
329329
330330
:return: A :class:`~prepared_stmt.PreparedStatement` instance.
331331
"""
332-
self.__check_open()
332+
self._check_open()
333333
stmt = await self._get_statement(query, timeout, named=True)
334334
return prepared_stmt.PreparedStatement(self, query, stmt)
335335

@@ -342,7 +342,7 @@ async def fetch(self, query, *args, timeout=None) -> list:
342342
343343
:return list: A list of :class:`Record` instances.
344344
"""
345-
self.__check_open()
345+
self._check_open()
346346
return await self._execute(query, args, 0, timeout)
347347

348348
async def fetchval(self, query, *args, column=0, timeout=None):
@@ -359,7 +359,7 @@ async def fetchval(self, query, *args, column=0, timeout=None):
359359
360360
:return: The value of the specified column of the first record.
361361
"""
362-
self.__check_open()
362+
self._check_open()
363363
data = await self._execute(query, args, 1, timeout)
364364
if not data:
365365
return None
@@ -374,7 +374,7 @@ async def fetchrow(self, query, *args, timeout=None):
374374
375375
:return: The first row as a :class:`Record` instance.
376376
"""
377-
self.__check_open()
377+
self._check_open()
378378
data = await self._execute(query, args, 1, timeout)
379379
if not data:
380380
return None
@@ -395,7 +395,7 @@ async def set_type_codec(self, typename, *,
395395
data. If ``False`` (the default), the data is
396396
expected to be encoded/decoded in text.
397397
"""
398-
self.__check_open()
398+
self._check_open()
399399

400400
if self._type_by_name_stmt is None:
401401
self._type_by_name_stmt = await self.prepare(
@@ -425,7 +425,7 @@ async def set_builtin_type_codec(self, typename, *,
425425
(defaults to 'public')
426426
:param codec_name: The name of the builtin codec.
427427
"""
428-
self.__check_open()
428+
self._check_open()
429429

430430
if self._type_by_name_stmt is None:
431431
self._type_by_name_stmt = await self.prepare(
@@ -470,13 +470,13 @@ def terminate(self):
470470
self._protocol.abort()
471471

472472
async def reset(self):
473-
self.__check_open()
473+
self._check_open()
474474
self._listeners.clear()
475475
reset_query = self._get_reset_query()
476476
if reset_query:
477477
await self.execute(reset_query)
478478

479-
def __check_open(self):
479+
def _check_open(self):
480480
if self.is_closed():
481481
raise exceptions.InterfaceError('connection is closed')
482482

asyncpg/prepared_stmt.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def get_parameters(self):
6060
# (Type(oid=23, name='int4', kind='scalar', schema='pg_catalog'),
6161
# Type(oid=25, name='text', kind='scalar', schema='pg_catalog'))
6262
"""
63-
self.__check_open()
63+
self._check_open()
6464
return self._state._get_parameters()
6565

6666
def get_attributes(self):
@@ -85,7 +85,7 @@ def get_attributes(self):
8585
# type=Type(oid=26, name='oid', kind='scalar',
8686
# schema='pg_catalog')))
8787
"""
88-
self.__check_open()
88+
self._check_open()
8989
return self._state._get_attributes()
9090

9191
def cursor(self, *args, prefetch=None,
@@ -99,7 +99,7 @@ def cursor(self, *args, prefetch=None,
9999
100100
:return: A :class:`~cursor.CursorFactory` object.
101101
"""
102-
self.__check_open()
102+
self._check_open()
103103
return cursor.CursorFactory(self._connection, self._query,
104104
self._state, args, prefetch,
105105
timeout)
@@ -190,14 +190,14 @@ async def fetchrow(self, *args, timeout=None):
190190
return data[0]
191191

192192
async def __bind_execute(self, args, limit, timeout):
193-
self.__check_open()
193+
self._check_open()
194194
protocol = self._connection._protocol
195195
data, status, _ = await protocol.bind_execute(
196196
self._state, args, '', limit, True, timeout)
197197
self._last_status = status
198198
return data
199199

200-
def __check_open(self):
200+
def _check_open(self):
201201
if self._state.closed:
202202
raise exceptions.InterfaceError('prepared statement is closed')
203203

0 commit comments

Comments
 (0)