Skip to content

Commit 963c699

Browse files
committed
fix: ruff
1 parent b7ab904 commit 963c699

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

posthog/exception_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,9 @@ def serialize_code_variables(
10721072
limiter.add(redacted_size)
10731073
result[name] = redacted_value
10741074
else:
1075-
serialized = _serialize_variable_value(value, limiter, max_length, compiled_mask)
1075+
serialized = _serialize_variable_value(
1076+
value, limiter, max_length, compiled_mask
1077+
)
10761078
if serialized is None:
10771079
break
10781080
result[name] = serialized

posthog/test/test_exception_capture.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,26 @@ def process_data():
117117
assert b"'my_number': 42" in output
118118
assert b"'my_bool': 'True'" in output
119119
assert b'"my_dict": "{\\"name\\": \\"test\\", \\"value\\": 123}"' in output
120-
assert b'{\\"safe_key\\": \\"safe_value\\", \\"password\\": \\"$$_posthog_redacted_based_on_masking_rules_$$\\", \\"other_key\\": \\"$$_posthog_redacted_based_on_masking_rules_$$\\"}' in output
121-
assert b'{\\"level1\\": {\\"level2\\": {\\"api_key\\": \\"$$_posthog_redacted_based_on_masking_rules_$$\\", \\"data\\": \\"$$_posthog_redacted_based_on_masking_rules_$$\\", \\"safe\\": \\"visible\\"}}}' in output
122-
assert b'[\\"safe_item\\", \\"$$_posthog_redacted_based_on_masking_rules_$$\\", \\"another_safe\\"]' in output
123-
assert b'[\\"tuple_safe\\", \\"$$_posthog_redacted_based_on_masking_rules_$$\\", \\"tuple_also_safe\\"]' in output
124-
assert b'[{\\"id\\": 1, \\"password\\": \\"$$_posthog_redacted_based_on_masking_rules_$$\\"}, {\\"id\\": 2, \\"value\\": \\"safe_value\\"}]' in output
120+
assert (
121+
b'{\\"safe_key\\": \\"safe_value\\", \\"password\\": \\"$$_posthog_redacted_based_on_masking_rules_$$\\", \\"other_key\\": \\"$$_posthog_redacted_based_on_masking_rules_$$\\"}'
122+
in output
123+
)
124+
assert (
125+
b'{\\"level1\\": {\\"level2\\": {\\"api_key\\": \\"$$_posthog_redacted_based_on_masking_rules_$$\\", \\"data\\": \\"$$_posthog_redacted_based_on_masking_rules_$$\\", \\"safe\\": \\"visible\\"}}}'
126+
in output
127+
)
128+
assert (
129+
b'[\\"safe_item\\", \\"$$_posthog_redacted_based_on_masking_rules_$$\\", \\"another_safe\\"]'
130+
in output
131+
)
132+
assert (
133+
b'[\\"tuple_safe\\", \\"$$_posthog_redacted_based_on_masking_rules_$$\\", \\"tuple_also_safe\\"]'
134+
in output
135+
)
136+
assert (
137+
b'[{\\"id\\": 1, \\"password\\": \\"$$_posthog_redacted_based_on_masking_rules_$$\\"}, {\\"id\\": 2, \\"value\\": \\"safe_value\\"}]'
138+
in output
139+
)
125140
assert b"<__main__.UnserializableObject object at" in output
126141
assert b"'my_password': '$$_posthog_redacted_based_on_masking_rules_$$'" in output
127142
assert (

0 commit comments

Comments
 (0)