22import contextvars
33from dataclasses import dataclass
44import typing as t
5- import warnings
65
76import asyncpg # type: ignore
87from asyncpg .connection import Connection # type: ignore
@@ -291,26 +290,28 @@ async def prep_database(self):
291290 # methods for now to ensure backwards compatility.
292291
293292 async def start_connnection_pool (self , ** kwargs ) -> None :
294- warnings .warn (
295- "This is a typo - please upgrade to `start_connection_pool`. This "
296- "proxy method will be retired in the future."
293+ colored_warning (
294+ "`start_connnection_pool` is a typo - please change it to "
295+ "`start_connection_pool`." ,
296+ category = DeprecationWarning ,
297297 )
298298 return await self .start_connection_pool ()
299299
300300 async def close_connnection_pool (self , ** kwargs ) -> None :
301- warnings .warn (
302- "This is a typo - please upgrade to `close_connection_pool`. This "
303- "proxy method will be retired in the future."
301+ colored_warning (
302+ "`close_connnection_pool` is a typo - please change it to "
303+ "`close_connection_pool`." ,
304+ category = DeprecationWarning ,
304305 )
305306 return await self .close_connection_pool ()
306307
307308 ###########################################################################
308309
309310 async def start_connection_pool (self , ** kwargs ) -> None :
310311 if self .pool :
311- warnings . warn (
312+ colored_warning (
312313 "A pool already exists - close it first if you want to create "
313- "a new pool."
314+ "a new pool." ,
314315 )
315316 else :
316317 config = dict (self .config )
@@ -322,7 +323,7 @@ async def close_connection_pool(self) -> None:
322323 await self .pool .close ()
323324 self .pool = None
324325 else :
325- warnings . warn ("No pool is running." )
326+ colored_warning ("No pool is running." )
326327
327328 ###########################################################################
328329
0 commit comments