Skip to content

Commit 7ea55a3

Browse files
fix: apply ruff formatting
1 parent d2c7ef7 commit 7ea55a3

2 files changed

Lines changed: 16 additions & 12 deletions

File tree

instrumentation/opentelemetry-instrumentation-asyncpg/src/opentelemetry/instrumentation/asyncpg/__init__.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright The OpenTelemetry Authors
1+
# Copyright The OpenTelemetry Authors
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -114,20 +114,24 @@ def _hydrate_span_from_args(connection, query, parameters) -> dict:
114114

115115
class AsyncPGInstrumentor(BaseInstrumentor):
116116
_leading_comment_remover = re.compile(r"^/\*.*?\*/")
117-
_CLEANUP_QUERIES = frozenset([
118-
"SELECT pg_advisory_unlock_all()",
119-
"CLOSE ALL",
120-
"UNLISTEN *",
121-
"RESET ALL",
122-
])
117+
_CLEANUP_QUERIES = frozenset(
118+
[
119+
"SELECT pg_advisory_unlock_all()",
120+
"CLOSE ALL",
121+
"UNLISTEN *",
122+
"RESET ALL",
123+
]
124+
)
123125
_tracer = None
124126

125127
def _is_cleanup_query(self, query: str) -> bool:
126128
if query is None:
127129
return False
128130
return any(q in query for q in self._CLEANUP_QUERIES)
129131

130-
def __init__(self, capture_parameters=False, capture_connection_cleanup=True):
132+
def __init__(
133+
self, capture_parameters=False, capture_connection_cleanup=True
134+
):
131135
super().__init__()
132136
self.capture_parameters = capture_parameters
133137
self.capture_connection_cleanup = capture_connection_cleanup
@@ -196,7 +200,9 @@ async def _do_execute(self, func, instance, args, kwargs):
196200
args[0],
197201
args[1:] if self.capture_parameters else None,
198202
)
199-
if not self.capture_connection_cleanup and self._is_cleanup_query(args[0]):
203+
if not self.capture_connection_cleanup and self._is_cleanup_query(
204+
args[0]
205+
):
200206
return await func(*args, **kwargs)
201207

202208
with self._tracer.start_as_current_span(

instrumentation/opentelemetry-instrumentation-asyncpg/tests/test_asyncpg_wrapper.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import asyncio
1+
import asyncio
22
from unittest import mock
33

44
import pytest
@@ -172,5 +172,3 @@ async def mock_execute(*args, **kwargs):
172172

173173
spans = self.memory_exporter.get_finished_spans()
174174
self.assertEqual(len(spans), 0)
175-
176-

0 commit comments

Comments
 (0)