6666
6767# Try importing audio processing libraries (optional dependencies)
6868try :
69- import numpy as np
70- import soundfile as sf
69+ import numpy as np # pyright: ignore[reportMissingImports]
70+ import soundfile as sf # pyright: ignore[reportMissingImports]
7171
7272 _audio_libs_available = True
7373except ImportError :
@@ -591,7 +591,7 @@ def _convert_pcm16_to_wav(
591591
592592 try :
593593 # Convert PCM16 byte data to numpy int16 array
594- audio_np = np .frombuffer (pcm_data , dtype = np .int16 ) # pyright: ignore[reportUnknownMemberType]
594+ audio_np = np .frombuffer (pcm_data , dtype = np .int16 ) # pyright: ignore[reportUnknownVariableType, reportUnknownMemberType]
595595
596596 # Write WAV data to memory buffer
597597 buffer = io .BytesIO ()
@@ -1190,28 +1190,21 @@ def _collect_http_uris(
11901190
11911191 @staticmethod
11921192 def _read_applied_strategy_version () -> int :
1193- from opentelemetry .util .genai ._multimodal_upload .config import ( # pylint: disable=import-outside-toplevel,no-name-in-module
1193+ from opentelemetry .util .genai ._multimodal_upload .config import ( # pylint: disable=import-outside-toplevel,no-name-in-module # noqa: PLC0415
11941194 get_multimodal_config_snapshot ,
11951195 )
11961196
11971197 return get_multimodal_config_snapshot ().strategy_version
11981198
11991199 def _sync_strategy_from_snapshot (self , config_snapshot : Any ) -> bool :
12001200 """Apply strategy fields when snapshot strategy_version changes."""
1201- if (
1202- config_snapshot .strategy_version
1203- != self ._applied_strategy_version
1204- ):
1201+ if config_snapshot .strategy_version != self ._applied_strategy_version :
12051202 self ._process_input = config_snapshot .process_input
12061203 self ._process_output = config_snapshot .process_output
12071204 self ._download_enabled = config_snapshot .download_enabled
12081205 self ._local_file_enabled = config_snapshot .local_file_enabled
1209- self ._allowed_root_paths = list (
1210- config_snapshot .allowed_root_paths
1211- )
1212- self ._applied_strategy_version = (
1213- config_snapshot .strategy_version
1214- )
1206+ self ._allowed_root_paths = list (config_snapshot .allowed_root_paths )
1207+ self ._applied_strategy_version = config_snapshot .strategy_version
12151208 return self ._process_input or self ._process_output
12161209
12171210 def pre_upload ( # pylint: disable=too-many-branches
@@ -1241,7 +1234,7 @@ def pre_upload( # pylint: disable=too-many-branches
12411234 uploads : List [PreUploadItem ] = []
12421235
12431236 if config_snapshot is None :
1244- from opentelemetry .util .genai ._multimodal_upload .config import ( # pylint: disable=import-outside-toplevel,no-name-in-module
1237+ from opentelemetry .util .genai ._multimodal_upload .config import ( # pylint: disable=import-outside-toplevel,no-name-in-module # noqa: PLC0415
12451238 get_multimodal_config_snapshot ,
12461239 )
12471240
@@ -1266,7 +1259,6 @@ def _pre_upload_with_current_config(
12661259 output_messages : Optional [List [Any ]],
12671260 uploads : List [PreUploadItem ],
12681261 ) -> List [PreUploadItem ]:
1269-
12701262 trace_id : Optional [str ] = None
12711263 span_id : Optional [str ] = None
12721264 try :
@@ -1330,13 +1322,15 @@ def fs_pre_uploader_hook(
13301322) -> Optional [PreUploader ]:
13311323 """Create file-system pre-uploader from runtime snapshot."""
13321324 if snapshot is None :
1333- from opentelemetry .util .genai ._multimodal_upload .config import ( # pylint: disable=import-outside-toplevel,no-name-in-module
1325+ from opentelemetry .util .genai ._multimodal_upload .config import ( # pylint: disable=import-outside-toplevel,no-name-in-module # noqa: PLC0415
13341326 get_multimodal_config_snapshot ,
13351327 )
13361328
13371329 snapshot = get_multimodal_config_snapshot ()
13381330
1339- base_path = snapshot .effective_storage_base_path or snapshot .storage_base_path
1331+ base_path = (
1332+ snapshot .effective_storage_base_path or snapshot .storage_base_path
1333+ )
13401334 if not base_path :
13411335 _logger .warning (
13421336 "%s is required but not set, multimodal pre-uploader disabled" ,
0 commit comments