44import sys as _sys
55import _thread
66import _contextvars
7+ lazy import warnings
78
89from time import monotonic as _time
910from _weakrefset import WeakSet
@@ -444,9 +445,7 @@ def notifyAll(self):
444445 This method is deprecated, use notify_all() instead.
445446
446447 """
447- import warnings
448- warnings .warn ('notifyAll() is deprecated, use notify_all() instead' ,
449- DeprecationWarning , stacklevel = 2 )
448+ warnings ._deprecated ("notifyAll" , 'notifyAll() is deprecated, use notify_all() instead' , remove = (3 , 21 ))
450449 self .notify_all ()
451450
452451
@@ -616,9 +615,7 @@ def isSet(self):
616615 This method is deprecated, use is_set() instead.
617616
618617 """
619- import warnings
620- warnings .warn ('isSet() is deprecated, use is_set() instead' ,
621- DeprecationWarning , stacklevel = 2 )
618+ warnings ._deprecated ("isSet" , 'isSet() is deprecated, use is_set() instead' , remove = (3 , 21 ))
622619 return self .is_set ()
623620
624621 def set (self ):
@@ -1352,9 +1349,7 @@ def isDaemon(self):
13521349 This method is deprecated, use the daemon attribute instead.
13531350
13541351 """
1355- import warnings
1356- warnings .warn ('isDaemon() is deprecated, get the daemon attribute instead' ,
1357- DeprecationWarning , stacklevel = 2 )
1352+ warnings ._deprecated ('isDaemon' , 'isDaemon() is deprecated, get the daemon attribute instead' ,remove = (3 ,21 ))
13581353 return self .daemon
13591354
13601355 def setDaemon (self , daemonic ):
@@ -1363,9 +1358,7 @@ def setDaemon(self, daemonic):
13631358 This method is deprecated, use the .daemon property instead.
13641359
13651360 """
1366- import warnings
1367- warnings .warn ('setDaemon() is deprecated, set the daemon attribute instead' ,
1368- DeprecationWarning , stacklevel = 2 )
1361+ warnings ._deprecated ('setDaemon' , 'setDaemon() is deprecated, set the daemon attribute instead' , remove = (3 ,21 ))
13691362 self .daemon = daemonic
13701363
13711364 def getName (self ):
@@ -1374,9 +1367,7 @@ def getName(self):
13741367 This method is deprecated, use the name attribute instead.
13751368
13761369 """
1377- import warnings
1378- warnings .warn ('getName() is deprecated, get the name attribute instead' ,
1379- DeprecationWarning , stacklevel = 2 )
1370+ warnings ._deprecated ('getName' , 'getName() is deprecated, get the name attribute instead' , remove = (3 ,21 ))
13801371 return self .name
13811372
13821373 def setName (self , name ):
@@ -1385,9 +1376,7 @@ def setName(self, name):
13851376 This method is deprecated, use the name attribute instead.
13861377
13871378 """
1388- import warnings
1389- warnings .warn ('setName() is deprecated, set the name attribute instead' ,
1390- DeprecationWarning , stacklevel = 2 )
1379+ warnings ._deprecated ('setName' , 'setName() is deprecated, set the name attribute instead' , remove = (3 ,21 ))
13911380 self .name = name
13921381
13931382
@@ -1621,9 +1610,7 @@ def currentThread():
16211610 This function is deprecated, use current_thread() instead.
16221611
16231612 """
1624- import warnings
1625- warnings .warn ('currentThread() is deprecated, use current_thread() instead' ,
1626- DeprecationWarning , stacklevel = 2 )
1613+ warnings ._deprecated ('currentThread' , 'currentThread() is deprecated, use current_thread() instead' , remove = (3 ,21 ))
16271614 return current_thread ()
16281615
16291616def active_count ():
@@ -1644,9 +1631,7 @@ def activeCount():
16441631 This function is deprecated, use active_count() instead.
16451632
16461633 """
1647- import warnings
1648- warnings .warn ('activeCount() is deprecated, use active_count() instead' ,
1649- DeprecationWarning , stacklevel = 2 )
1634+ warnings ._deprecated ('activeCount' , 'activeCount() is deprecated, use active_count() instead' , remove = (3 ,21 ))
16501635 return active_count ()
16511636
16521637def _enumerate ():
0 commit comments