diff --git a/.buildinfo b/.buildinfo index c470b951f3..d9063147b9 100644 --- a/.buildinfo +++ b/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 3b487acafaaa48e4419e9ce22fa98b11 +config: 2e6cd5c82d10449c01cac1b11fe6f6d8 tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/.doctrees/apidocs.doctree b/.doctrees/apidocs.doctree index e600cf6e9f..a134aa1b27 100644 Binary files a/.doctrees/apidocs.doctree and b/.doctrees/apidocs.doctree differ diff --git a/.doctrees/environment.pickle b/.doctrees/environment.pickle index 456be32215..b20d34e904 100644 Binary files a/.doctrees/environment.pickle and b/.doctrees/environment.pickle differ diff --git a/_modules/index.html b/_modules/index.html index c37ae93de6..8a797171ea 100644 --- a/_modules/index.html +++ b/_modules/index.html @@ -2,7 +2,7 @@
-
from collections.abc import Mapping
from datetime import datetime, timezone
from importlib import import_module
-from typing import cast
+from typing import cast, overload
from sentry_sdk._compat import PY37, check_uwsgi_thread_support
from sentry_sdk.utils import (
@@ -160,889 +160,915 @@ Source code for sentry_sdk.client
from typing import Sequence
from typing import Type
from typing import Union
-
- from sentry_sdk._types import Event, Hint, SDKInfo
- from sentry_sdk.integrations import Integration
- from sentry_sdk.metrics import MetricsAggregator
- from sentry_sdk.scope import Scope
- from sentry_sdk.session import Session
- from sentry_sdk.transport import Transport
-
+ from typing import TypeVar
+
+ from sentry_sdk._types import Event, Hint, SDKInfo
+ from sentry_sdk.integrations import Integration
+ from sentry_sdk.metrics import MetricsAggregator
+ from sentry_sdk.scope import Scope
+ from sentry_sdk.session import Session
+ from sentry_sdk.transport import Transport
-_client_init_debug = ContextVar("client_init_debug")
+ I = TypeVar("I", bound=Integration) # noqa: E741
-
-SDK_INFO = {
- "name": "sentry.python", # SDK name will be overridden after integrations have been loaded with sentry_sdk.integrations.setup_integrations()
- "version": VERSION,
- "packages": [{"name": "pypi:sentry-sdk", "version": VERSION}],
-} # type: SDKInfo
-
-
-def _get_options(*args, **kwargs):
- # type: (*Optional[str], **Any) -> Dict[str, Any]
- if args and (isinstance(args[0], (bytes, str)) or args[0] is None):
- dsn = args[0] # type: Optional[str]
- args = args[1:]
- else:
- dsn = None
-
- if len(args) > 1:
- raise TypeError("Only single positional argument is expected")
-
- rv = dict(DEFAULT_OPTIONS)
- options = dict(*args, **kwargs)
- if dsn is not None and options.get("dsn") is None:
- options["dsn"] = dsn
-
- for key, value in options.items():
- if key not in rv:
- raise TypeError("Unknown option %r" % (key,))
-
- rv[key] = value
+_client_init_debug = ContextVar("client_init_debug")
+
+
+SDK_INFO = {
+ "name": "sentry.python", # SDK name will be overridden after integrations have been loaded with sentry_sdk.integrations.setup_integrations()
+ "version": VERSION,
+ "packages": [{"name": "pypi:sentry-sdk", "version": VERSION}],
+} # type: SDKInfo
+
+
+def _get_options(*args, **kwargs):
+ # type: (*Optional[str], **Any) -> Dict[str, Any]
+ if args and (isinstance(args[0], (bytes, str)) or args[0] is None):
+ dsn = args[0] # type: Optional[str]
+ args = args[1:]
+ else:
+ dsn = None
+
+ if len(args) > 1:
+ raise TypeError("Only single positional argument is expected")
+
+ rv = dict(DEFAULT_OPTIONS)
+ options = dict(*args, **kwargs)
+ if dsn is not None and options.get("dsn") is None:
+ options["dsn"] = dsn
+
+ for key, value in options.items():
+ if key not in rv:
+ raise TypeError("Unknown option %r" % (key,))
- if rv["dsn"] is None:
- rv["dsn"] = os.environ.get("SENTRY_DSN")
-
- if rv["release"] is None:
- rv["release"] = get_default_release()
-
- if rv["environment"] is None:
- rv["environment"] = os.environ.get("SENTRY_ENVIRONMENT") or "production"
-
- if rv["debug"] is None:
- rv["debug"] = env_to_bool(os.environ.get("SENTRY_DEBUG", "False"), strict=True)
-
- if rv["server_name"] is None and hasattr(socket, "gethostname"):
- rv["server_name"] = socket.gethostname()
-
- if rv["instrumenter"] is None:
- rv["instrumenter"] = INSTRUMENTER.SENTRY
-
- if rv["project_root"] is None:
- try:
- project_root = os.getcwd()
- except Exception:
- project_root = None
-
- rv["project_root"] = project_root
+ rv[key] = value
+
+ if rv["dsn"] is None:
+ rv["dsn"] = os.environ.get("SENTRY_DSN")
+
+ if rv["release"] is None:
+ rv["release"] = get_default_release()
+
+ if rv["environment"] is None:
+ rv["environment"] = os.environ.get("SENTRY_ENVIRONMENT") or "production"
+
+ if rv["debug"] is None:
+ rv["debug"] = env_to_bool(os.environ.get("SENTRY_DEBUG", "False"), strict=True)
+
+ if rv["server_name"] is None and hasattr(socket, "gethostname"):
+ rv["server_name"] = socket.gethostname()
+
+ if rv["instrumenter"] is None:
+ rv["instrumenter"] = INSTRUMENTER.SENTRY
+
+ if rv["project_root"] is None:
+ try:
+ project_root = os.getcwd()
+ except Exception:
+ project_root = None
- if rv["enable_tracing"] is True and rv["traces_sample_rate"] is None:
- rv["traces_sample_rate"] = 1.0
-
- if rv["event_scrubber"] is None:
- rv["event_scrubber"] = EventScrubber(send_default_pii=rv["send_default_pii"])
-
- if rv["socket_options"] and not isinstance(rv["socket_options"], list):
- logger.warning(
- "Ignoring socket_options because of unexpected format. See urllib3.HTTPConnection.socket_options for the expected format."
- )
- rv["socket_options"] = None
-
- return rv
+ rv["project_root"] = project_root
+
+ if rv["enable_tracing"] is True and rv["traces_sample_rate"] is None:
+ rv["traces_sample_rate"] = 1.0
+
+ if rv["event_scrubber"] is None:
+ rv["event_scrubber"] = EventScrubber(send_default_pii=rv["send_default_pii"])
+
+ if rv["socket_options"] and not isinstance(rv["socket_options"], list):
+ logger.warning(
+ "Ignoring socket_options because of unexpected format. See urllib3.HTTPConnection.socket_options for the expected format."
+ )
+ rv["socket_options"] = None
-
-try:
- # Python 3.6+
- module_not_found_error = ModuleNotFoundError
-except Exception:
- # Older Python versions
- module_not_found_error = ImportError # type: ignore
-
-
+ return rv
+
+
+try:
+ # Python 3.6+
+ module_not_found_error = ModuleNotFoundError
+except Exception:
+ # Older Python versions
+ module_not_found_error = ImportError # type: ignore
+
+
[docs]
-class BaseClient:
- """
- .. versionadded:: 2.0.0
-
- The basic definition of a client that is used for sending data to Sentry.
- """
-
- def __init__(self, options=None):
- # type: (Optional[Dict[str, Any]]) -> None
- self.options = (
- options if options is not None else DEFAULT_OPTIONS
- ) # type: Dict[str, Any]
-
- self.transport = None # type: Optional[Transport]
- self.monitor = None # type: Optional[Monitor]
- self.metrics_aggregator = None # type: Optional[MetricsAggregator]
-
- def __getstate__(self, *args, **kwargs):
- # type: (*Any, **Any) -> Any
- return {"options": {}}
-
- def __setstate__(self, *args, **kwargs):
- # type: (*Any, **Any) -> None
- pass
-
- @property
- def dsn(self):
- # type: () -> Optional[str]
- return None
-
- def should_send_default_pii(self):
- # type: () -> bool
- return False
-
+class BaseClient:
+ """
+ .. versionadded:: 2.0.0
+
+ The basic definition of a client that is used for sending data to Sentry.
+ """
+
+ def __init__(self, options=None):
+ # type: (Optional[Dict[str, Any]]) -> None
+ self.options = (
+ options if options is not None else DEFAULT_OPTIONS
+ ) # type: Dict[str, Any]
+
+ self.transport = None # type: Optional[Transport]
+ self.monitor = None # type: Optional[Monitor]
+ self.metrics_aggregator = None # type: Optional[MetricsAggregator]
+
+ def __getstate__(self, *args, **kwargs):
+ # type: (*Any, **Any) -> Any
+ return {"options": {}}
+
+ def __setstate__(self, *args, **kwargs):
+ # type: (*Any, **Any) -> None
+ pass
+
+ @property
+ def dsn(self):
+ # type: () -> Optional[str]
+ return None
+
+ def should_send_default_pii(self):
+ # type: () -> bool
+ return False
+
[docs]
- def is_active(self):
- # type: () -> bool
- """
- .. versionadded:: 2.0.0
-
- Returns whether the client is active (able to send data to Sentry)
- """
- return False
+ def is_active(self):
+ # type: () -> bool
+ """
+ .. versionadded:: 2.0.0
+
+ Returns whether the client is active (able to send data to Sentry)
+ """
+ return False
-
- def capture_event(self, *args, **kwargs):
- # type: (*Any, **Any) -> Optional[str]
- return None
-
- def capture_session(self, *args, **kwargs):
- # type: (*Any, **Any) -> None
- return None
-
- def get_integration(self, *args, **kwargs):
- # type: (*Any, **Any) -> Any
- return None
+
+ def capture_event(self, *args, **kwargs):
+ # type: (*Any, **Any) -> Optional[str]
+ return None
+
+ def capture_session(self, *args, **kwargs):
+ # type: (*Any, **Any) -> None
+ return None
+
+ if TYPE_CHECKING:
- def close(self, *args, **kwargs):
- # type: (*Any, **Any) -> None
- return None
-
- def flush(self, *args, **kwargs):
- # type: (*Any, **Any) -> None
- return None
-
- def __enter__(self):
- # type: () -> BaseClient
- return self
-
- def __exit__(self, exc_type, exc_value, tb):
- # type: (Any, Any, Any) -> None
- return None
+ @overload
+ def get_integration(self, name_or_class):
+ # type: (str) -> Optional[Integration]
+ ...
+
+ @overload
+ def get_integration(self, name_or_class):
+ # type: (type[I]) -> Optional[I]
+ ...
+
+ def get_integration(self, name_or_class):
+ # type: (Union[str, type[Integration]]) -> Optional[Integration]
+ return None
+
+ def close(self, *args, **kwargs):
+ # type: (*Any, **Any) -> None
+ return None
+
+ def flush(self, *args, **kwargs):
+ # type: (*Any, **Any) -> None
+ return None
+
+ def __enter__(self):
+ # type: () -> BaseClient
+ return self
+
+ def __exit__(self, exc_type, exc_value, tb):
+ # type: (Any, Any, Any) -> None
+ return None