Skip to content

Commit e4b0ea4

Browse files
committed
fixup lint
1 parent e9f6caf commit e4b0ea4

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

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

+6-2
Original file line numberDiff line numberDiff line change
@@ -736,11 +736,15 @@ def _instrument(self, **kwargs):
736736
async_response_hook = kwargs.get("async_response_hook")
737737
if callable(request_hook):
738738
_InstrumentedClient._request_hook = request_hook
739-
if callable(async_request_hook) and iscoroutinefunction(async_request_hook):
739+
if callable(async_request_hook) and iscoroutinefunction(
740+
async_request_hook
741+
):
740742
_InstrumentedAsyncClient._request_hook = async_request_hook
741743
if callable(response_hook):
742744
_InstrumentedClient._response_hook = response_hook
743-
if callable(async_response_hook) and iscoroutinefunction(async_response_hook):
745+
if callable(async_response_hook) and iscoroutinefunction(
746+
async_response_hook
747+
):
744748
_InstrumentedAsyncClient._response_hook = async_response_hook
745749
tracer_provider = kwargs.get("tracer_provider")
746750
_InstrumentedClient._tracer_provider = tracer_provider

instrumentation/opentelemetry-instrumentation-httpx/tests/test_httpx_integration.py

+13-9
Original file line numberDiff line numberDiff line change
@@ -780,13 +780,15 @@ def test_custom_tracer_provider(self):
780780
HTTPXClientInstrumentor().uninstrument()
781781

782782
def test_response_hook(self):
783-
response_hook_key = "async_response_hook" if asyncio.iscoroutinefunction(self.response_hook) else "response_hook"
784-
response_hook_kwargs = {
785-
response_hook_key: self.response_hook
786-
}
783+
response_hook_key = (
784+
"async_response_hook"
785+
if asyncio.iscoroutinefunction(self.response_hook)
786+
else "response_hook"
787+
)
788+
response_hook_kwargs = {response_hook_key: self.response_hook}
787789
HTTPXClientInstrumentor().instrument(
788790
tracer_provider=self.tracer_provider,
789-
**response_hook_kwargs
791+
**response_hook_kwargs,
790792
)
791793
client = self.create_client()
792794
result = self.perform_request(self.URL, client=client)
@@ -827,10 +829,12 @@ def test_response_hook_sync_async_kwargs(self):
827829
HTTPXClientInstrumentor().uninstrument()
828830

829831
def test_request_hook(self):
830-
request_hook_key = "async_request_hook" if asyncio.iscoroutinefunction(self.request_hook) else "request_hook"
831-
request_hook_kwargs = {
832-
request_hook_key: self.request_hook
833-
}
832+
request_hook_key = (
833+
"async_request_hook"
834+
if asyncio.iscoroutinefunction(self.request_hook)
835+
else "request_hook"
836+
)
837+
request_hook_kwargs = {request_hook_key: self.request_hook}
834838
HTTPXClientInstrumentor().instrument(
835839
tracer_provider=self.tracer_provider,
836840
**request_hook_kwargs,

0 commit comments

Comments
 (0)