22
33import sys as _sys
44import _thread
5- import warnings
65
76from time import time as _time , sleep as _sleep
87from traceback import format_exc as _format_exc
98from collections import deque
109
10+ # Note regarding PEP 8 compliant names
11+ # This threading model was originally inspired by Java, and inherited
12+ # the convention of camelCase function and method names from that
13+ # language. Those originaly names are not in any imminent danger of
14+ # being deprecated (even for Py3k),so this module provides them as an
15+ # alias for the PEP 8 compliant names
16+ # Note that using the new PEP 8 compliant names facilitates substitution
17+ # with the multiprocessing module, which doesn't provide the old
18+ # Java inspired names.
19+
20+
1121# Rename some stuff so "from threading import *" is safe
1222__all__ = ['active_count' , 'Condition' , 'current_thread' , 'enumerate' , 'Event' ,
1323 'Lock' , 'RLock' , 'Semaphore' , 'BoundedSemaphore' , 'Thread' ,
@@ -262,6 +272,8 @@ def notify(self, n=1):
262272 def notify_all (self ):
263273 self .notify (len (self ._waiters ))
264274
275+ notifyAll = notify_all
276+
265277
266278def Semaphore (* args , ** kwargs ):
267279 return _Semaphore (* args , ** kwargs )
@@ -341,10 +353,7 @@ def __init__(self, verbose=None):
341353 def is_set (self ):
342354 return self ._flag
343355
344- def isSet (self ):
345- warnings .warn ("isSet() is deprecated in favor of is_set()" ,
346- DeprecationWarning )
347- return self .is_set ()
356+ isSet = is_set
348357
349358 def set (self ):
350359 self ._cond .acquire ()
@@ -646,10 +655,7 @@ def is_alive(self):
646655 assert self ._initialized , "Thread.__init__() not called"
647656 return self ._started .is_set () and not self ._stopped
648657
649- def isAlive (self ):
650- warnings .warn ("isAlive() is deprecated in favor of is_alive()" ,
651- DeprecationWarning )
652- return self .is_alive ()
658+ isAlive = is_alive
653659
654660 @property
655661 def daemon (self ):
@@ -665,23 +671,15 @@ def daemon(self, daemonic):
665671 self ._daemonic = daemonic
666672
667673 def isDaemon (self ):
668- warnings .warn ("isDaemon() is deprecated in favor of the " \
669- "Thread.daemon property" , DeprecationWarning )
670674 return self .daemon
671675
672676 def setDaemon (self , daemonic ):
673- warnings .warn ("setDaemon() is deprecated in favor of the " \
674- "Thread.daemon property" , DeprecationWarning )
675677 self .daemon = daemonic
676678
677679 def getName (self ):
678- warnings .warn ("getName() is deprecated in favor of the " \
679- "Thread.name property" , DeprecationWarning )
680680 return self .name
681681
682682 def setName (self , name ):
683- warnings .warn ("setName() is deprecated in favor of the " \
684- "Thread.name property" , DeprecationWarning )
685683 self .name = name
686684
687685# The timer class was contributed by Itamar Shtull-Trauring
@@ -790,20 +788,15 @@ def current_thread():
790788 ##print "current_thread(): no current thread for", _get_ident()
791789 return _DummyThread ()
792790
793- def currentThread ():
794- warnings .warn ("currentThread() is deprecated in favor of current_thread()" ,
795- DeprecationWarning )
791+ currentThread = current_thread
796792
797793def active_count ():
798794 _active_limbo_lock .acquire ()
799795 count = len (_active ) + len (_limbo )
800796 _active_limbo_lock .release ()
801797 return count
802798
803- def activeCount ():
804- warnings .warn ("activeCount() is deprecated in favor of active_count()" ,
805- DeprecationWarning )
806- return active_count ()
799+ activeCount = active_count
807800
808801def enumerate ():
809802 _active_limbo_lock .acquire ()
0 commit comments