U 췀gt@s|ddlZddlZddlZddlZddlmZddlmZddlm Z e r`ddlm Z ddlm Z ddZ Gd d d eZ dS) N)logger) Integration) TYPE_CHECKING)Any)OptionalcCsHdd}|d||d||dtjdkr2dp4dtjd S) zThis is the default shutdown callback that is set on the options. It prints out a message to stderr that informs the user that some events are still pending and the process is waiting for them to flush out. cSstj|ddS)N )sysstderrwrite)msgr L/opt/hc_python/lib/python3.8/site-packages/sentry_sdk/integrations/atexit.pyechoszdefault_callback..echoz.Sentry is attempting to send %i pending eventszWaiting up to %s secondszPress Ctrl-%s to quitntBreakCN)osnamerr flush)pendingtimeoutrr r r default_callbacks   rc@s&eZdZdZdddZeddZdS)AtexitIntegrationatexitNcCs|dkr t}||_dS)N)rcallback)selfrr r r __init__#szAtexitIntegration.__init__cCstjdd}dS)NcSsPt}|t}|dkrdStdtdt|j|j ddS)Nzatexit: got shutdown signalzatexit: shutting down client)r) sentry_sdkZ get_clientZget_integrationrrdebugZget_isolation_scopeZ end_sessioncloser)clientZ integrationr r r _shutdown,s    z/AtexitIntegration.setup_once.._shutdown)rregister)r!r r r setup_once)szAtexitIntegration.setup_once)N)__name__ __module__ __qualname__ identifierr staticmethodr#r r r r r s r)rrrrZsentry_sdk.utilsrZsentry_sdk.integrationsrtypingrrrrrr r r r s