Skip to content

Commit 032afe8

Browse files
committed
ran black
1 parent 8889fad commit 032afe8

File tree

6 files changed

+11
-10
lines changed

6 files changed

+11
-10
lines changed

example.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ def process_order(order_id):
112112
# Exception will be captured and tagged automatically
113113
raise Exception("Order processing failed")
114114

115+
115116
# You can also use the directly context manager, but you should prefer to use the decorator where possible,
116117
# because it's tricky to remember to always capture the exception within the context scope.
117118
with posthog.new_context():

posthog/exception_integrations/django.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class DjangoIntegration:
3232
identifier = "django"
3333

3434
def __init__(self, capture_exception_fn=None):
35-
3635
if DJANGO_VERSION < (4, 2):
3736
raise IntegrationEnablingError("Django 4.2 or newer is required.")
3837

@@ -60,7 +59,6 @@ def uninstall(self):
6059

6160

6261
class DjangoRequestExtractor:
63-
6462
def __init__(self, request):
6563
# type: (Any) -> None
6664
self.request = request

posthog/exception_utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525

2626
if TYPE_CHECKING:
27-
2827
from types import FrameType, TracebackType
2928
from typing import ( # noqa: F401
3029
Any,

posthog/scopes.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
_scopes_local = threading.local()
66

7+
78
def _init_guard() -> None:
89
if not hasattr(_scopes_local, "context_stack"):
910
_scopes_local.context_stack = [{}]
@@ -78,7 +79,9 @@ def clear_tags() -> None:
7879
_get_current_context().clear()
7980

8081

81-
F = TypeVar('F', bound=Callable[..., Any])
82+
F = TypeVar("F", bound=Callable[..., Any])
83+
84+
8285
def tracked(func: F) -> F:
8386
"""
8487
Decorator that creates a new context for the function, wraps the function in a

posthog/sentry/posthog_integration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ def processor(event, hint):
4343
not not Hub.current.client.dsn and Dsn(Hub.current.client.dsn).project_id
4444
)
4545
if project_id:
46-
properties["$sentry_url"] = (
47-
f"{PostHogIntegration.prefix}{PostHogIntegration.organization}/issues/?project={project_id}&query={event['event_id']}"
48-
)
46+
properties[
47+
"$sentry_url"
48+
] = f"{PostHogIntegration.prefix}{PostHogIntegration.organization}/issues/?project={project_id}&query={event['event_id']}"
4949

5050
posthog.capture(posthog_distinct_id, "$exception", properties)
5151

posthog/test/test_scopes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def test_nested_contexts(self):
6161
# Back to level 1
6262
self.assertEqual(get_tags(), {"level1": "value1"})
6363

64-
@patch('posthog.capture_exception')
64+
@patch("posthog.capture_exception")
6565
def test_tracked_decorator_success(self, mock_capture):
6666
@tracked
6767
def successful_function(x, y):
@@ -80,7 +80,7 @@ def successful_function(x, y):
8080
# Context should be cleared after function execution
8181
self.assertEqual(get_tags(), {})
8282

83-
@patch('posthog.capture_exception')
83+
@patch("posthog.capture_exception")
8484
def test_tracked_decorator_exception(self, mock_capture):
8585
test_exception = ValueError("Test exception")
8686

@@ -101,7 +101,7 @@ def failing_function():
101101
self.assertEqual(args[0], test_exception)
102102

103103
# Check that the context was included in properties
104-
self.assertEqual(kwargs.get('properties', {}).get('important_context'), "value")
104+
self.assertEqual(kwargs.get("properties", {}).get("important_context"), "value")
105105

106106
# Context should be cleared after function execution
107107
self.assertEqual(get_tags(), {})

0 commit comments

Comments
 (0)