Skip to content

Commit

Permalink
fixup lint
Browse files Browse the repository at this point in the history
  • Loading branch information
xrmx committed Aug 25, 2024
1 parent e9f6caf commit e4b0ea4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -736,11 +736,15 @@ def _instrument(self, **kwargs):
async_response_hook = kwargs.get("async_response_hook")
if callable(request_hook):
_InstrumentedClient._request_hook = request_hook
if callable(async_request_hook) and iscoroutinefunction(async_request_hook):
if callable(async_request_hook) and iscoroutinefunction(
async_request_hook
):
_InstrumentedAsyncClient._request_hook = async_request_hook
if callable(response_hook):
_InstrumentedClient._response_hook = response_hook
if callable(async_response_hook) and iscoroutinefunction(async_response_hook):
if callable(async_response_hook) and iscoroutinefunction(
async_response_hook
):
_InstrumentedAsyncClient._response_hook = async_response_hook
tracer_provider = kwargs.get("tracer_provider")
_InstrumentedClient._tracer_provider = tracer_provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -780,13 +780,15 @@ def test_custom_tracer_provider(self):
HTTPXClientInstrumentor().uninstrument()

def test_response_hook(self):
response_hook_key = "async_response_hook" if asyncio.iscoroutinefunction(self.response_hook) else "response_hook"
response_hook_kwargs = {
response_hook_key: self.response_hook
}
response_hook_key = (
"async_response_hook"
if asyncio.iscoroutinefunction(self.response_hook)
else "response_hook"
)
response_hook_kwargs = {response_hook_key: self.response_hook}
HTTPXClientInstrumentor().instrument(
tracer_provider=self.tracer_provider,
**response_hook_kwargs
**response_hook_kwargs,
)
client = self.create_client()
result = self.perform_request(self.URL, client=client)
Expand Down Expand Up @@ -827,10 +829,12 @@ def test_response_hook_sync_async_kwargs(self):
HTTPXClientInstrumentor().uninstrument()

def test_request_hook(self):
request_hook_key = "async_request_hook" if asyncio.iscoroutinefunction(self.request_hook) else "request_hook"
request_hook_kwargs = {
request_hook_key: self.request_hook
}
request_hook_key = (
"async_request_hook"
if asyncio.iscoroutinefunction(self.request_hook)
else "request_hook"
)
request_hook_kwargs = {request_hook_key: self.request_hook}
HTTPXClientInstrumentor().instrument(
tracer_provider=self.tracer_provider,
**request_hook_kwargs,
Expand Down

0 comments on commit e4b0ea4

Please sign in to comment.