本文整理匯總了Python中signal.__dict__方法的典型用法代碼示例。如果您正苦於以下問題:Python signal.__dict__方法的具體用法?Python signal.__dict__怎麽用?Python signal.__dict__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類signal
的用法示例。
在下文中一共展示了signal.__dict__方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: signal_initialize
# 需要導入模塊: import signal [as 別名]
# 或者: from signal import __dict__ [as 別名]
def signal_initialize():
import signal
signal.signal(signal.SIGTERM, sig_exit)
signal.signal(signal.SIGINT, sig_exit)
signal.signal(signal.SIGABRT, sig_exit)
if 'SIGQUIT' in signal.__dict__:
signal.signal(signal.SIGQUIT, sig_exit)
if 'SIGCHLD' in signal.__dict__:
signal.signal(signal.SIGCHLD, sig_chld)
if 'SIGPIPE' in signal.__dict__:
signal.signal(signal.SIGPIPE, signal.SIG_IGN)
return 0
#----------------------------------------------------------------------
# logs
#----------------------------------------------------------------------
示例2: _signal_status_msg
# 需要導入模塊: import signal [as 別名]
# 或者: from signal import __dict__ [as 別名]
def _signal_status_msg(type_, signr):
s = "%s by signal %d" % (type_, signr)
for name in signal.__dict__:
if name.startswith("SIG") and getattr(signal, name) == signr:
return "%s (%s)" % (s, name)
return s
示例3: __str__
# 需要導入模塊: import signal [as 別名]
# 或者: from signal import __dict__ [as 別名]
def __str__(self):
for name, val in signal.__dict__.iteritems():
if name.startswith('SIG') and val == self.sigNum:
break
if val == self.sigNum:
return 'SignalException: signal %s received' % name
else:
return 'SignalException: signal %d received' % self.sigNum