MCPcopy
hub / github.com/InstaPy/InstaPy / interruption_handler

Function interruption_handler

instapy/util.py:1335–1357  ·  view source on GitHub ↗

Handles external interrupt, usually initiated by the user like KeyboardInterrupt with CTRL+C

(
    threaded=False,
    SIG_type=signal.SIGINT,
    handler=signal.SIG_IGN,
    notify=None,
    logger=None,
)

Source from the content-addressed store, hash-verified

1333
1334@contextmanager
1335def interruption_handler(
1336 threaded=False,
1337 SIG_type=signal.SIGINT,
1338 handler=signal.SIG_IGN,
1339 notify=None,
1340 logger=None,
1341):
1342 """Handles external interrupt, usually initiated by the user like
1343 KeyboardInterrupt with CTRL+C"""
1344 if notify is not None and logger is not None:
1345 logger.warning(notify)
1346
1347 original_handler = None
1348
1349 if not threaded:
1350 original_handler = signal.signal(SIG_type, handler)
1351
1352 try:
1353 yield
1354
1355 finally:
1356 if not threaded:
1357 signal.signal(SIG_type, original_handler)
1358
1359
1360def highlight_print(

Callers 15

log_followed_poolFunction · 0.85
log_record_all_followedFunction · 0.85
close_browserFunction · 0.85
endMethod · 0.85
get_followersFunction · 0.85
get_followingFunction · 0.85
store_followers_dataFunction · 0.85
store_following_dataFunction · 0.85
store_all_unfollowersFunction · 0.85
store_active_unfollowersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected