/opt/imunify360/venv/lib/python3.11/site-packages/sentry_sdk/integrations
NameSizeModeActions
django/-0755rm
spark/-0755rm
__pycache__/-0755rm
aiohttp.py79600644editdlrm
argv.py9450644editdlrm
asgi.py83680644editdlrm
atexit.py18370644editdlrm
aws_lambda.py129410644editdlrm
beam.py56620644editdlrm
boto3.py37270644editdlrm
bottle.py61870644editdlrm
celery.py91190644editdlrm
chalice.py45730644editdlrm
dedupe.py11660644editdlrm
excepthook.py21900644editdlrm
executing.py20230644editdlrm
falcon.py67960644editdlrm
flask.py74280644editdlrm
gcp.py73820644editdlrm
gnu_backtrace.py29120644editdlrm
logging.py75730644editdlrm
modules.py13930644editdlrm
pure_eval.py45200644editdlrm
pyramid.py70720644editdlrm
redis.py30750644editdlrm
rq.py47910644editdlrm
sanic.py77090644editdlrm
serverless.py19710644editdlrm
sqlalchemy.py29390644editdlrm
stdlib.py73480644editdlrm
threading.py28560644editdlrm
tornado.py70010644editdlrm
trytond.py17280644editdlrm
wsgi.py103740644editdlrm
_wsgi_common.py47630644editdlrm
__init__.py65090644editdlrm
Edit: /opt/imunify360/venv/lib/python3.11/site-packages/sentry_sdk/integrations/excepthook.py (2190B)
import sys from sentry_sdk.hub import Hub from sentry_sdk.utils import capture_internal_exceptions, event_from_exception from sentry_sdk.integrations import Integration from sentry_sdk._types import MYPY if MYPY: from typing import Callable from typing import Any from typing import Type from types import TracebackType Excepthook = Callable[ [Type[BaseException], BaseException, TracebackType], Any, ] class ExcepthookIntegration(Integration): identifier = "excepthook" always_run = False def __init__(self, always_run=False): # type: (bool) -> None if not isinstance(always_run, bool): raise ValueError( "Invalid value for always_run: %s (must be type boolean)" % (always_run,) ) self.always_run = always_run @staticmethod def setup_once(): # type: () -> None sys.excepthook = _make_excepthook(sys.excepthook) def _make_excepthook(old_excepthook): # type: (Excepthook) -> Excepthook def sentry_sdk_excepthook(type_, value, traceback): # type: (Type[BaseException], BaseException, TracebackType) -> None hub = Hub.current integration = hub.get_integration(ExcepthookIntegration) if integration is not None and _should_send(integration.always_run): # If an integration is there, a client has to be there. client = hub.client # type: Any with capture_internal_exceptions(): event, hint = event_from_exception( (type_, value, traceback), client_options=client.options, mechanism={"type": "excepthook", "handled": False}, ) hub.capture_event(event, hint=hint) return old_excepthook(type_, value, traceback) return sentry_sdk_excepthook def _should_send(always_run=False): # type: (bool) -> bool if always_run: return True if hasattr(sys, "ps1"): # Disable the excepthook for interactive Python shells, otherwise # every typo gets sent to Sentry. return False return True