Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../usr/lib64/python3....
File: signal.py
import _signal
[0] Fix | Delete
from _signal import *
[1] Fix | Delete
from functools import wraps as _wraps
[2] Fix | Delete
from enum import IntEnum as _IntEnum
[3] Fix | Delete
[4] Fix | Delete
_globals = globals()
[5] Fix | Delete
[6] Fix | Delete
_IntEnum._convert(
[7] Fix | Delete
'Signals', __name__,
[8] Fix | Delete
lambda name:
[9] Fix | Delete
name.isupper()
[10] Fix | Delete
and (name.startswith('SIG') and not name.startswith('SIG_'))
[11] Fix | Delete
or name.startswith('CTRL_'))
[12] Fix | Delete
[13] Fix | Delete
_IntEnum._convert(
[14] Fix | Delete
'Handlers', __name__,
[15] Fix | Delete
lambda name: name in ('SIG_DFL', 'SIG_IGN'))
[16] Fix | Delete
[17] Fix | Delete
if 'pthread_sigmask' in _globals:
[18] Fix | Delete
_IntEnum._convert(
[19] Fix | Delete
'Sigmasks', __name__,
[20] Fix | Delete
lambda name: name in ('SIG_BLOCK', 'SIG_UNBLOCK', 'SIG_SETMASK'))
[21] Fix | Delete
[22] Fix | Delete
[23] Fix | Delete
def _int_to_enum(value, enum_klass):
[24] Fix | Delete
"""Convert a numeric value to an IntEnum member.
[25] Fix | Delete
If it's not a known member, return the numeric value itself.
[26] Fix | Delete
"""
[27] Fix | Delete
try:
[28] Fix | Delete
return enum_klass(value)
[29] Fix | Delete
except ValueError:
[30] Fix | Delete
return value
[31] Fix | Delete
[32] Fix | Delete
[33] Fix | Delete
def _enum_to_int(value):
[34] Fix | Delete
"""Convert an IntEnum member to a numeric value.
[35] Fix | Delete
If it's not an IntEnum member return the value itself.
[36] Fix | Delete
"""
[37] Fix | Delete
try:
[38] Fix | Delete
return int(value)
[39] Fix | Delete
except (ValueError, TypeError):
[40] Fix | Delete
return value
[41] Fix | Delete
[42] Fix | Delete
[43] Fix | Delete
@_wraps(_signal.signal)
[44] Fix | Delete
def signal(signalnum, handler):
[45] Fix | Delete
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
[46] Fix | Delete
return _int_to_enum(handler, Handlers)
[47] Fix | Delete
[48] Fix | Delete
[49] Fix | Delete
@_wraps(_signal.getsignal)
[50] Fix | Delete
def getsignal(signalnum):
[51] Fix | Delete
handler = _signal.getsignal(signalnum)
[52] Fix | Delete
return _int_to_enum(handler, Handlers)
[53] Fix | Delete
[54] Fix | Delete
[55] Fix | Delete
if 'pthread_sigmask' in _globals:
[56] Fix | Delete
@_wraps(_signal.pthread_sigmask)
[57] Fix | Delete
def pthread_sigmask(how, mask):
[58] Fix | Delete
sigs_set = _signal.pthread_sigmask(how, mask)
[59] Fix | Delete
return set(_int_to_enum(x, Signals) for x in sigs_set)
[60] Fix | Delete
pthread_sigmask.__doc__ = _signal.pthread_sigmask.__doc__
[61] Fix | Delete
[62] Fix | Delete
[63] Fix | Delete
if 'sigpending' in _globals:
[64] Fix | Delete
@_wraps(_signal.sigpending)
[65] Fix | Delete
def sigpending():
[66] Fix | Delete
sigs = _signal.sigpending()
[67] Fix | Delete
return set(_int_to_enum(x, Signals) for x in sigs)
[68] Fix | Delete
[69] Fix | Delete
[70] Fix | Delete
if 'sigwait' in _globals:
[71] Fix | Delete
@_wraps(_signal.sigwait)
[72] Fix | Delete
def sigwait(sigset):
[73] Fix | Delete
retsig = _signal.sigwait(sigset)
[74] Fix | Delete
return _int_to_enum(retsig, Signals)
[75] Fix | Delete
sigwait.__doc__ = _signal.sigwait
[76] Fix | Delete
[77] Fix | Delete
del _globals, _wraps
[78] Fix | Delete
[79] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function