Skip to content

Commit 0c277ac

Browse files
WIP: fixing the lint in files.
1 parent 881686b commit 0c277ac

5 files changed

Lines changed: 11 additions & 20 deletions

File tree

instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,9 @@
1414

1515
from __future__ import annotations
1616

17-
from typing import Optional
18-
19-
from opentelemetry.semconv._incubating.attributes import (
20-
gen_ai_attributes as GenAIAttributes,
21-
)
22-
from opentelemetry.semconv._incubating.attributes import (
23-
server_attributes as ServerAttributes,
24-
)
2517
from opentelemetry.util.genai.handler import TelemetryHandler
2618
from opentelemetry.util.genai.types import ContentCapturingMode, Error
2719

28-
from .instruments import Instruments
2920
from .response_extractors import (
3021
_apply_request_attributes,
3122
_get_inference_creation_kwargs,

instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/response_extractors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
server_attributes as ServerAttributes,
3939
)
4040

41+
from .utils import get_server_address_and_port, value_is_set
42+
4143
_PYDANTIC_V2 = hasattr(BaseModel, "model_validate")
4244

4345
if _PYDANTIC_V2:
@@ -70,8 +72,6 @@
7072
Text = None
7173
ToolCall = None
7274

73-
from .utils import get_server_address_and_port, value_is_set
74-
7575
GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS = "gen_ai.usage.cache_read.input_tokens"
7676
GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS = (
7777
"gen_ai.usage.cache_creation.input_tokens"

instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_response_wrappers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,13 +372,13 @@ async def test_async_stream_wrapper_processes_events_and_stops_on_completion():
372372
wrapper.process_event = processed.append
373373
wrapper._stop = stopped.append
374374

375-
result = await wrapper.__anext__()
375+
result = await anext(wrapper)
376376

377377
assert result is event
378378
assert processed == [event]
379379

380380
with pytest.raises(StopAsyncIteration):
381-
await wrapper.__anext__()
381+
await anext(wrapper)
382382

383383
assert stopped == [None]
384384

@@ -417,7 +417,7 @@ def record_failure(message, error_type):
417417
wrapper._fail = record_failure
418418

419419
with pytest.raises(ValueError, match="boom"):
420-
await wrapper.__anext__()
420+
await anext(wrapper)
421421

422422
assert failures == [("boom", ValueError)]
423423

instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
)
4646

4747
try:
48+
# Responses is not available in the oldest supported OpenAI SDK, so keep
49+
# this import guarded. Pylint runs against the oldest dependency set and
50+
# cannot resolve this optional module there.
51+
# pylint: disable-next=no-name-in-module
4852
from openai.resources.responses.responses import Responses as _Responses
4953

5054
HAS_RESPONSES_API = True
@@ -329,7 +333,7 @@ def test_responses_create_connection_error(span_exporter, instrument_no_content)
329333
client = OpenAI(base_url="http://localhost:4242")
330334

331335
with pytest.raises(APIConnectionError):
332-
client.responses.create(
336+
client.responses.create( # pylint: disable=no-member
333337
model=DEFAULT_MODEL,
334338
input="Hello",
335339
timeout=0.1,
@@ -476,7 +480,7 @@ def test_responses_create_streaming_connection_error(
476480
client = OpenAI(base_url="http://localhost:4242")
477481

478482
with pytest.raises(APIConnectionError):
479-
client.responses.create(
483+
client.responses.create( # pylint: disable=no-member
480484
model=DEFAULT_MODEL,
481485
input="Hello",
482486
stream=True,

instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_utils.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,8 @@
1515
"""Shared test utilities for OpenAI instrumentation tests."""
1616

1717
import json
18-
import os
19-
from pathlib import Path
2018
from typing import Any, Optional
2119

22-
import pytest
23-
2420
from opentelemetry.instrumentation.openai_v2.response_extractors import (
2521
GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS,
2622
GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS,

0 commit comments

Comments
 (0)