Browse files

Add snake-case function names for 'threading2'-module

Closes: #165
  • Loading branch information...
kamgha authored and rdb committed Aug 26, 2017
1 parent bbdc5d2 commit b9437316b441f732ad56309e7d908d2799d2a646
Showing with 22 additions and 7 deletions.
  1. +22 −7 direct/src/stdpy/
@@ -24,9 +24,18 @@
from traceback import format_exc as _format_exc
# Rename some stuff so "from threading import *" is safe
__all__ = ['activeCount', 'Condition', 'currentThread', 'enumerate', 'Event',
'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread',
'Timer', 'setprofile', 'settrace', 'local', 'stack_size']
__all__ = [
'enumerate', 'active_count', 'activeCount',
'current_thread', 'currentThread',
'Lock', 'RLock',
'Semaphore', 'BoundedSemaphore',
'setprofile', 'settrace', 'stack_size'
_start_new_thread = thread.start_new_thread
_allocate_lock = thread.allocate_lock
@@ -581,10 +590,12 @@ def setName(self, name):
assert self.__initialized, "Thread.__init__() not called"
self.__name = str(name)
def isAlive(self):
def is_alive(self):
assert self.__initialized, "Thread.__init__() not called"
return self.__started and not self.__stopped
isAlive = is_alive
def isDaemon(self):
assert self.__initialized, "Thread.__init__() not called"
return self.__daemonic
@@ -692,19 +703,23 @@ def join(self, timeout=None):
# Global API functions
def currentThread():
def current_thread():
return _active[_get_ident()]
except KeyError:
##print "currentThread(): no current thread for", _get_ident()
##print "current_thread(): no current thread for", _get_ident()
return _DummyThread()
def activeCount():
currentThread = current_thread
def active_count():
count = len(_active) + len(_limbo)
return count
activeCount = active_count
def enumerate():
active = list(_active.values()) + list(_limbo.values())

0 comments on commit b943731

Please sign in to comment.