@@ -118,7 +118,7 @@ async def add_listener(self, channel, callback):
118
118
**channel**: name of the channel the notification was sent to;
119
119
**payload**: the payload.
120
120
"""
121
- self .__check_open ()
121
+ self ._check_open ()
122
122
if channel not in self ._listeners :
123
123
await self .fetch ('LISTEN {}' .format (channel ))
124
124
self ._listeners [channel ] = set ()
@@ -182,7 +182,7 @@ def transaction(self, *, isolation='read_committed', readonly=False,
182
182
.. _`PostgreSQL documentation`: https://www.postgresql.org/docs/\
183
183
current/static/sql-set-transaction.html
184
184
"""
185
- self .__check_open ()
185
+ self ._check_open ()
186
186
return transaction .Transaction (self , isolation , readonly , deferrable )
187
187
188
188
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:
213
213
.. versionchanged:: 0.5.4
214
214
Made it possible to pass query arguments.
215
215
"""
216
- self .__check_open ()
216
+ self ._check_open ()
217
217
218
218
if not args :
219
219
return await self ._protocol .query (query , timeout )
@@ -244,7 +244,7 @@ async def executemany(self, command: str, args,
244
244
245
245
.. versionadded:: 0.7.0
246
246
"""
247
- self .__check_open ()
247
+ self ._check_open ()
248
248
249
249
if 'timeout' in kw :
250
250
timeout = kw .pop ('timeout' )
@@ -317,7 +317,7 @@ def cursor(self, query, *args, prefetch=None, timeout=None):
317
317
318
318
:return: A :class:`~cursor.CursorFactory` object.
319
319
"""
320
- self .__check_open ()
320
+ self ._check_open ()
321
321
return cursor .CursorFactory (self , query , None , args ,
322
322
prefetch , timeout )
323
323
@@ -329,7 +329,7 @@ async def prepare(self, query, *, timeout=None):
329
329
330
330
:return: A :class:`~prepared_stmt.PreparedStatement` instance.
331
331
"""
332
- self .__check_open ()
332
+ self ._check_open ()
333
333
stmt = await self ._get_statement (query , timeout , named = True )
334
334
return prepared_stmt .PreparedStatement (self , query , stmt )
335
335
@@ -342,7 +342,7 @@ async def fetch(self, query, *args, timeout=None) -> list:
342
342
343
343
:return list: A list of :class:`Record` instances.
344
344
"""
345
- self .__check_open ()
345
+ self ._check_open ()
346
346
return await self ._execute (query , args , 0 , timeout )
347
347
348
348
async def fetchval (self , query , * args , column = 0 , timeout = None ):
@@ -359,7 +359,7 @@ async def fetchval(self, query, *args, column=0, timeout=None):
359
359
360
360
:return: The value of the specified column of the first record.
361
361
"""
362
- self .__check_open ()
362
+ self ._check_open ()
363
363
data = await self ._execute (query , args , 1 , timeout )
364
364
if not data :
365
365
return None
@@ -374,7 +374,7 @@ async def fetchrow(self, query, *args, timeout=None):
374
374
375
375
:return: The first row as a :class:`Record` instance.
376
376
"""
377
- self .__check_open ()
377
+ self ._check_open ()
378
378
data = await self ._execute (query , args , 1 , timeout )
379
379
if not data :
380
380
return None
@@ -395,7 +395,7 @@ async def set_type_codec(self, typename, *,
395
395
data. If ``False`` (the default), the data is
396
396
expected to be encoded/decoded in text.
397
397
"""
398
- self .__check_open ()
398
+ self ._check_open ()
399
399
400
400
if self ._type_by_name_stmt is None :
401
401
self ._type_by_name_stmt = await self .prepare (
@@ -425,7 +425,7 @@ async def set_builtin_type_codec(self, typename, *,
425
425
(defaults to 'public')
426
426
:param codec_name: The name of the builtin codec.
427
427
"""
428
- self .__check_open ()
428
+ self ._check_open ()
429
429
430
430
if self ._type_by_name_stmt is None :
431
431
self ._type_by_name_stmt = await self .prepare (
@@ -470,13 +470,13 @@ def terminate(self):
470
470
self ._protocol .abort ()
471
471
472
472
async def reset (self ):
473
- self .__check_open ()
473
+ self ._check_open ()
474
474
self ._listeners .clear ()
475
475
reset_query = self ._get_reset_query ()
476
476
if reset_query :
477
477
await self .execute (reset_query )
478
478
479
- def __check_open (self ):
479
+ def _check_open (self ):
480
480
if self .is_closed ():
481
481
raise exceptions .InterfaceError ('connection is closed' )
482
482
0 commit comments