Coverage for /var/srv/projects/api.amasfac.comuna18.com/tmp/venv/lib/python3.9/site-packages/sentry_sdk/consts.py: 55%

32 statements  

« prev     ^ index     » next       coverage.py v6.4.4, created at 2023-07-17 14:22 -0600

1from sentry_sdk._types import MYPY 

2 

3if MYPY: 3 ↛ 4line 3 didn't jump to line 4, because the condition on line 3 was never true

4 import sentry_sdk 

5 

6 from typing import Optional 

7 from typing import Callable 

8 from typing import Union 

9 from typing import List 

10 from typing import Type 

11 from typing import Dict 

12 from typing import Any 

13 from typing import Sequence 

14 from typing_extensions import TypedDict 

15 

16 from sentry_sdk.integrations import Integration 

17 

18 from sentry_sdk._types import ( 

19 BreadcrumbProcessor, 

20 Event, 

21 EventProcessor, 

22 TracesSampler, 

23 ) 

24 

25 # Experiments are feature flags to enable and disable certain unstable SDK 

26 # functionality. Changing them from the defaults (`None`) in production 

27 # code is highly discouraged. They are not subject to any stability 

28 # guarantees such as the ones from semantic versioning. 

29 Experiments = TypedDict( 

30 "Experiments", 

31 { 

32 "max_spans": Optional[int], 

33 "record_sql_params": Optional[bool], 

34 "smart_transaction_trimming": Optional[bool], 

35 "propagate_tracestate": Optional[bool], 

36 "custom_measurements": Optional[bool], 

37 }, 

38 total=False, 

39 ) 

40 

41DEFAULT_QUEUE_SIZE = 100 

42DEFAULT_MAX_BREADCRUMBS = 100 

43 

44 

45# This type exists to trick mypy and PyCharm into thinking `init` and `Client` 

46# take these arguments (even though they take opaque **kwargs) 

47class ClientConstructor(object): 

48 def __init__( 

49 self, 

50 dsn=None, # type: Optional[str] 

51 with_locals=True, # type: bool 

52 max_breadcrumbs=DEFAULT_MAX_BREADCRUMBS, # type: int 

53 release=None, # type: Optional[str] 

54 environment=None, # type: Optional[str] 

55 server_name=None, # type: Optional[str] 

56 shutdown_timeout=2, # type: float 

57 integrations=[], # type: Sequence[Integration] # noqa: B006 

58 in_app_include=[], # type: List[str] # noqa: B006 

59 in_app_exclude=[], # type: List[str] # noqa: B006 

60 default_integrations=True, # type: bool 

61 dist=None, # type: Optional[str] 

62 transport=None, # type: Optional[Union[sentry_sdk.transport.Transport, Type[sentry_sdk.transport.Transport], Callable[[Event], None]]] 

63 transport_queue_size=DEFAULT_QUEUE_SIZE, # type: int 

64 sample_rate=1.0, # type: float 

65 send_default_pii=False, # type: bool 

66 http_proxy=None, # type: Optional[str] 

67 https_proxy=None, # type: Optional[str] 

68 ignore_errors=[], # type: List[Union[type, str]] # noqa: B006 

69 request_bodies="medium", # type: str 

70 before_send=None, # type: Optional[EventProcessor] 

71 before_breadcrumb=None, # type: Optional[BreadcrumbProcessor] 

72 debug=False, # type: bool 

73 attach_stacktrace=False, # type: bool 

74 ca_certs=None, # type: Optional[str] 

75 propagate_traces=True, # type: bool 

76 traces_sample_rate=None, # type: Optional[float] 

77 traces_sampler=None, # type: Optional[TracesSampler] 

78 auto_enabling_integrations=True, # type: bool 

79 auto_session_tracking=True, # type: bool 

80 send_client_reports=True, # type: bool 

81 _experiments={}, # type: Experiments # noqa: B006 

82 ): 

83 # type: (...) -> None 

84 pass 

85 

86 

87def _get_default_options(): 

88 # type: () -> Dict[str, Any] 

89 import inspect 

90 

91 if hasattr(inspect, "getfullargspec"): 91 ↛ 94line 91 didn't jump to line 94, because the condition on line 91 was never false

92 getargspec = inspect.getfullargspec 

93 else: 

94 getargspec = inspect.getargspec # type: ignore 

95 

96 a = getargspec(ClientConstructor.__init__) 

97 defaults = a.defaults or () 

98 return dict(zip(a.args[-len(defaults) :], defaults)) 

99 

100 

101DEFAULT_OPTIONS = _get_default_options() 

102del _get_default_options 

103 

104 

105VERSION = "1.7.2" 

106SDK_INFO = { 

107 "name": "sentry.python", 

108 "version": VERSION, 

109 "packages": [{"name": "pypi:sentry-sdk", "version": VERSION}], 

110}