MCPcopy Create free account
hub / github.com/alibaba/GraphScope / SignalIgnore

Class SignalIgnore

python/graphscope/client/utils.py:325–351  ·  view source on GitHub ↗

Context Manager for signal ignore Args: signals (list of `signal.signal`): A list of signal you want to ignore. Examples: >>> with SignalIgnore(signal.SIGINT): >>> func_call() >>> with SignalIgnore([signal.SIGINT, signal.SIGTERM]):

Source from the content-addressed store, hash-verified

323
324
325class SignalIgnore(object):
326 """Context Manager for signal ignore
327
328 Args:
329 signals (list of `signal.signal`):
330 A list of signal you want to ignore.
331
332 Examples:
333
334 >>> with SignalIgnore(signal.SIGINT):
335 >>> func_call()
336
337 >>> with SignalIgnore([signal.SIGINT, signal.SIGTERM]):
338 >>> func_call()
339 """
340
341 def __init__(self, signal):
342 self._signal = list(signal)
343
344 def __enter__(self):
345 self._original_handler = [
346 signal.signal(s, signal.SIG_IGN) for s in self._signal
347 ]
348
349 def __exit__(self, exc_type, exc_value, exc_tb):
350 for s, h in zip(self._signal, self._original_handler):
351 signal.signal(s, h)
352
353
354def set_defaults(defaults):

Callers 1

closeMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected