Skip to content

Use linters in your project please #275

@nnikolov3

Description

@nnikolov3

(.venv) niko@agentic-tools:~/optillm$ ruff check --fix .
F401 adaptive_classifier imported but unused; consider using importlib.util.find_spec to test for availability
--> optillm/autothink/classifier.py:39:24
|
37 | # Check if adaptive-classifier is installed
38 | try:
39 | import adaptive_classifier
| ^^^^^^^^^^^^^^^^^^^
40 | except ImportError:
41 | logger.info("Installing adaptive-classifier library...")
|
help: Remove unused import: adaptive_classifier

F811 Redefinition of unused update_context from line 490
--> optillm/autothink/steering.py:542:9
|
540 | logger.debug(f"STEERING: Token history updated, now has {len(self.token_history)} tokens")
541 |
542 | def update_context(self, new_tokens: str):
| ^^^^^^^^^^^^^^ update_context redefined here
543 | """
544 | Update the context buffer with new tokens.
|
::: optillm/autothink/steering.py:490:9
|
488 | return hidden_states
489 |
490 | def update_context(self, new_tokens: str):
| -------------- previous definition of update_context here
491 | """
492 | Update the context buffer with new tokens.
|
help: Remove definition: update_context

F821 Undefined name local_completion_tokens
--> optillm/cepo/cepo.py:463:9
|
461 | cepo_config=cepo_config
462 | )
463 | local_completion_tokens += completion_tokens
| ^^^^^^^^^^^^^^^^^^^^^^^
464 |
465 | # Log provider call if conversation logging is enabled
|

F841 Local variable local_completion_tokens is assigned to but never used
--> optillm/cepo/cepo.py:463:9
|
461 | cepo_config=cepo_config
462 | )
463 | local_completion_tokens += completion_tokens
| ^^^^^^^^^^^^^^^^^^^^^^^
464 |
465 | # Log provider call if conversation logging is enabled
|
help: Remove assignment to unused variable local_completion_tokens

E722 Do not use bare except
--> optillm/cepo/cepo.py:867:5
|
865 | float(response_str)
866 | return [float(response_str)]
867 | except:
| ^^^^^^
868 | response_str = response_str.split("", 1)[1] if "" in response_str else response_str
869 | if last_n_chars is not None:
|

F841 Local variable thinking is assigned to but never used
--> optillm/cot_reflection.py:70:5
|
68 | output_match = re.search(r'(.*?)(?:|$)', full_response, re.DOTALL)
69 |
70 | thinking = thinking_match.group(1).strip() if thinking_match else "No thinking process provided."
| ^^^^^^^^
71 | output = output_match.group(1).strip() if output_match else full_response
|
help: Remove assignment to unused variable thinking

F841 Local variable token_confidence is assigned to but never used
--> optillm/deepconf/processor.py:126:13
|
125 | # Calculate confidence for current token
126 | token_confidence = self.confidence_calculator.add_token_confidence(logits)
| ^^^^^^^^^^^^^^^^
127 |
128 | # Check for early termination (only after minimum trace length)
|
help: Remove assignment to unused variable token_confidence

F401 mlx_lm.tokenizer_utils.TokenizerWrapper imported but unused; consider using importlib.util.find_spec to test for availability
--> optillm/inference.py:82:40
|
80 | import mlx.core as mx
81 | from mlx_lm import load as mlx_load, generate as mlx_generate
82 | from mlx_lm.tokenizer_utils import TokenizerWrapper
| ^^^^^^^^^^^^^^^^
83 | from mlx_lm.sample_utils import make_sampler
84 | MLX_AVAILABLE = True
|
help: Remove unused import: mlx_lm.tokenizer_utils.TokenizerWrapper

F401 flash_attn imported but unused; consider using importlib.util.find_spec to test for availability
--> optillm/inference.py:1048:28
|
1046 | # Check for flash attention availability
1047 | try:
1048 | import flash_attn
| ^^^^^^^^^^
1049 | has_flash_attn = True
1050 | logger.info("Flash Attention 2 is available")
|
help: Remove unused import: flash_attn

F841 Local variable has_flash_attn is assigned to but never used
--> optillm/inference.py:1053:21
|
1051 | model_kwargs["attn_implementation"] = "flash_attention_2"
1052 | except ImportError:
1053 | has_flash_attn = False
| ^^^^^^^^^^^^^^
1054 | logger.info("Flash Attention 2 is not installed - falling back to default attention")
|
help: Remove assignment to unused variable has_flash_attn

F841 Local variable config is assigned to but never used
--> optillm/inference.py:1135:13
|
1133 | """Validate if adapter exists and is compatible"""
1134 | try:
1135 | config = PeftConfig.from_pretrained(
| ^^^^^^
1136 | adapter_id,
1137 | trust_remote_code=True,
|
help: Remove assignment to unused variable config

F841 Local variable batch_system is assigned to but never used
--> optillm/inference.py:1541:13
|
1539 | for i in range(0, len(formatted_prompts), self.optimal_batch_size):
1540 | batch_prompts = formatted_prompts[i:i + self.optimal_batch_size]
1541 | batch_system = system_prompts[i:i + self.optimal_batch_size]
| ^^^^^^^^^^^^
1542 | batch_user = user_prompts[i:i + self.optimal_batch_size]
|
help: Remove assignment to unused variable batch_system

F841 Local variable batch_user is assigned to but never used
--> optillm/inference.py:1542:13
|
1540 | batch_prompts = formatted_prompts[i:i + self.optimal_batch_size]
1541 | batch_system = system_prompts[i:i + self.optimal_batch_size]
1542 | batch_user = user_prompts[i:i + self.optimal_batch_size]
| ^^^^^^^^^^
1543 |
1544 | # Check cache first if enabled
|
help: Remove assignment to unused variable batch_user

F841 Local variable strategy_sharing_summary is assigned to but never used
--> optillm/mars/mars.py:204:25
|
202 | # Share strategies across agents and generate enhanced solutions
203 | if config.get('cross_agent_enhancement', True) and extracted_strategies:
204 | strategy_sharing_summary = await strategy_network.share_strategies_across_agents(
| ^^^^^^^^^^^^^^^^^^^^^^^^
205 | workspace, extracted_strategies, request_id, executor
206 | )
|
help: Remove assignment to unused variable strategy_sharing_summary

E722 Do not use bare except
--> optillm/mars/mars.py:319:9
|
317 | fallback_solution, fallback_tokens = fallback_agent.generate_solution(initial_query, request_id)
318 | return fallback_solution.solution, fallback_tokens
319 | except:
| ^^^^^^
320 | return error_response, 0
|

E722 Do not use bare except
--> optillm/plugins/coc_plugin.py:221:13
|
219 | try:
220 | os.unlink(tmp_name)
221 | except:
| ^^^^^^
222 | pass
|

E722 Do not use bare except
--> optillm/plugins/coc_plugin.py:273:9
|
271 | try:
272 | answer = ast.literal_eval(result)
273 | except:
| ^^^^^^
274 | answer = result
275 | logger.info(f"Simulation successful. Result: {answer}")
|

F401 .research_engine.DeepResearcher imported but unused; consider removing, adding to __all__, or using a redundant alias
--> optillm/plugins/deep_research/init.py:8:30
|
6 | """
7 |
8 | from .research_engine import DeepResearcher
| ^^^^^^^^^^^^^^
9 |
10 | version = "1.0.0"
|
help: Use an explicit re-export: DeepResearcher as DeepResearcher

E722 Do not use bare except
--> optillm/plugins/deep_research/session_state.py:92:17
|
90 | try:
91 | self._sessions[session_id].close()
92 | except:
| ^^^^^^
93 | pass
94 | del self._sessions[session_id]
|

F841 Local variable module_name is assigned to but never used
--> optillm/plugins/deep_research_plugin.py:32:9
|
30 | """Detect the type of client based on class name"""
31 | class_name = self.client.class.name
32 | module_name = self.client.class.module
| ^^^^^^^^^^^
33 |
34 | # Check for OpenAI-compatible clients (OpenAI, Cerebras, AzureOpenAI)
|
help: Remove assignment to unused variable module_name

E722 Do not use bare except
--> optillm/plugins/deepthink/self_discover.py:350:17
|
348 | try:
349 | return json.loads(json_str)
350 | except:
| ^^^^^^
351 | continue
|

E712 Avoid equality comparisons to False; use not flag: for false checks
--> optillm/plugins/longcepo/chunking.py:219:16
|
217 | end -= 1
218 | flag = True
219 | if flag == False:
| ^^^^^^^^^^^^^
220 | break
221 | if start < end:
|
help: Replace with not flag

E731 Do not assign a lambda expression, use a def
--> optillm/plugins/longcepo/mapreduce.py:17:1
|
15 | )
16 |
17 | / format_chunk_list = lambda chunk_list: [
18 | | f"Information of Chunk {index}:\n{doc}\n" for index, doc in enumerate(chunk_list)
19 | | ]
| |_^
|
help: Rewrite format_chunk_list as a def

E731 Do not assign a lambda expression, use a def
--> optillm/plugins/longcepo/utils.py:81:5
|
79 | """
80 | result = [None] * len(context_chunks)
81 | wrapped_gen_function = lambda index, *args: (index, gen_function(*args))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
82 | with ThreadPoolExecutor(max_workers=workers) as executor:
83 | future_to_idx = {}
|
help: Rewrite wrapped_gen_function as a def

E722 Do not use bare except
--> optillm/plugins/mcp_plugin.py:59:9
|
57 | params_str = json.dumps(params, indent=2)
58 | message_parts.append(f"Params: {params_str}")
59 | except:
| ^^^^^^
60 | message_parts.append(f"Params: {params}")
|

E722 Do not use bare except
--> optillm/plugins/mcp_plugin.py:66:9
|
64 | result_str = json.dumps(result, indent=2)
65 | message_parts.append(f"Result: {result_str}")
66 | except:
| ^^^^^^
67 | message_parts.append(f"Result: {result}")
|

F841 Local variable test_response is assigned to but never used
--> optillm/plugins/proxy/client.py:185:17
|
184 | try:
185 | test_response = provider.client.chat.completions.create(
| ^^^^^^^^^^^^^
186 | model=model,
187 | messages=[
|
help: Remove assignment to unused variable test_response

F841 Local variable response is assigned to but never used
--> optillm/plugins/proxy/health.py:51:13
|
49 | # Simple health check - try to get models
50 | # This creates a minimal request to verify the endpoint is responsive
51 | response = provider.client.models.list()
| ^^^^^^^^
52 |
53 | # Mark as healthy
|
help: Remove assignment to unused variable response

F841 Local variable start_index is assigned to but never used
--> optillm/plugins/proxy/routing.py:43:9
|
42 | # Find next available provider in round-robin fashion
43 | start_index = self.index
| ^^^^^^^^^^^
44 | attempts = 0
45 | while attempts < len(self.all_providers):
|
help: Remove assignment to unused variable start_index

E402 Module level import not at top of file
--> optillm/plugins/proxy_plugin.py:18:1
|
17 | # Configure logging based on environment
18 | import os
| ^^^^^^^^^
19 | log_level = os.environ.get('OPTILLM_LOG_LEVEL', 'INFO')
20 | logging.basicConfig(level=getattr(logging, log_level))
|

F841 Local variable test_response is assigned to but never used
--> optillm/plugins/proxy_plugin.py:36:9
|
34 | try:
35 | # Try a minimal system message request
36 | test_response = proxy_client.chat.completions.create(
| ^^^^^^^^^^^^^
37 | model=model,
38 | messages=[
|
help: Remove assignment to unused variable test_response

F841 Local variable limited_count is assigned to but never used
--> optillm/plugins/spl/main.py:112:9
|
111 | # 4.2 Limit strategies per problem type (applies storage limit, not inference limit)
112 | limited_count = db.limit_strategies_per_type(max_per_type=MAX_STRATEGIES_PER_TYPE)
| ^^^^^^^^^^^^^
113 |
114 | # 4.3 Prune low-performing strategies
|
help: Remove assignment to unused variable limited_count

E722 Do not use bare except
--> optillm/plugins/web_search_plugin.py:73:21
|
71 | try:
72 | self._searcher.close()
73 | except:
| ^^^^^^
74 | pass # Ignore errors during cleanup
75 | self._searcher = None
|

E722 Do not use bare except
--> optillm/plugins/web_search_plugin.py:172:13
|
170 | self.driver.find_element(By.CSS_SELECTOR, "iframe[src*='recaptcha']")
171 | return True
172 | except:
| ^^^^^^
173 | pass
|

E722 Do not use bare except
--> optillm/plugins/web_search_plugin.py:179:13
|
177 | self.driver.find_element(By.ID, "captcha")
178 | return True
179 | except:
| ^^^^^^
180 | pass
|

E722 Do not use bare except
--> optillm/plugins/web_search_plugin.py:183:9
|
182 | return False
183 | except:
| ^^^^^^
184 | return False
|

E722 Do not use bare except
--> optillm/plugins/web_search_plugin.py:249:13
|
247 | accept_button.click()
248 | time.sleep(1)
249 | except:
| ^^^^^^
250 | pass # No consent form
|

E722 Do not use bare except
--> optillm/plugins/web_search_plugin.py:262:21
|
260 | )
261 | break
262 | except:
| ^^^^^^
263 | continue
|

E722 Do not use bare except
--> optillm/plugins/web_search_plugin.py:287:13
|
285 | else:
286 | raise Exception("Could not find search box")
287 | except:
| ^^^^^^
288 | # Fallback to direct URL navigation
289 | print("Using direct URL navigation...")
|

E722 Do not use bare except
--> optillm/plugins/web_search_plugin.py:314:25
|
312 | EC.presence_of_element_located((By.CSS_SELECTOR, "div.g"))
313 | )
314 | except:
| ^^^^^^
315 | print("No results found after CAPTCHA resolution")
316 | return []
|

E722 Do not use bare except
--> optillm/plugins/web_search_plugin.py:354:21
|
352 | lambda driver: driver.find_elements(By.CSS_SELECTOR, "div.g")
353 | )
354 | except:
| ^^^^^^
355 | print("Still no results after CAPTCHA resolution")
356 | return []
|

E722 Do not use bare except
--> optillm/plugins/web_search_plugin.py:386:21
|
384 | if h3 and link:
385 | search_results.append(elem)
386 | except:
| ^^^^^^
387 | continue
|

E722 Do not use bare except
--> optillm/plugins/web_search_plugin.py:428:33
|
426 | snippet = snippet_elem.text
427 | break
428 | except:
| ^^^^^^
429 | pass
430 | except:
|

E722 Do not use bare except
--> optillm/plugins/web_search_plugin.py:430:25
|
428 | except:
429 | pass
430 | except:
| ^^^^^^
431 | pass
|

E721 Use is and is not for type comparisons, or isinstance() for isinstance checks
--> optillm/server.py:999:16
|
997 | env_value = os.environ.get(env)
998 | if env_value is not None:
999 | if type_ == bool:
| ^^^^^^^^^^^^^
1000 | default = env_value.lower() in ('true', '1', 'yes')
1001 | else:
|

E721 Use is and is not for type comparisons, or isinstance() for isinstance checks
--> optillm/server.py:1006:16
|
1004 | parser.add_argument(arg, type=type_, default=default, help=help_text, choices=extra[0])
1005 | else:
1006 | if type_ == bool:
| ^^^^^^^^^^^^^
1007 | # For boolean flags, use store_true action
1008 | parser.add_argument(arg, action='store_true', default=default, help=help_text)
|

F841 Local variable can_use_true_batching is assigned to but never used
--> optillm/server.py:1130:21
|
1128 | req_data['operation'] != first_req['operation'] or
1129 | req_data['model'] != first_req['model']):
1130 | can_use_true_batching = False
| ^^^^^^^^^^^^^^^^^^^^^
1131 | break
|
help: Remove assignment to unused variable can_use_true_batching

F401 mlx.core imported but unused; consider using importlib.util.find_spec to test for availability
--> optillm/thinkdeeper_mlx.py:14:24
|
13 | try:
14 | import mlx.core as mx
| ^^
15 | from mlx_lm import generate as mlx_generate
16 | from mlx_lm.sample_utils import make_sampler
|
help: Remove unused import: mlx.core

F403 from z3 import * used; unable to detect undefined names
--> optillm/z3_solver.py:2:1
|
1 | from typing import Dict, Any
2 | from z3 import *
| ^^^^^^^^^^^^^^^^
3 | import sympy
4 | import io
|

F841 Local variable position is assigned to but never used
--> scripts/eval_aime_benchmark.py:166:9
|
165 | # Count thought transitions
166 | position = 0
| ^^^^^^^^
167 | for phrase in THOUGHT_TRANSITIONS:
168 | # Find all occurrences of each transition phrase
|
help: Remove assignment to unused variable position

E402 Module level import not at top of file
--> scripts/eval_imo25_benchmark.py:30:1
|
29 | # Import the actual IMO 2025 problems and reference solutions
30 | from imo25_reference import IMO_2025_PROBLEMS, verify_answer_format, verify_key_insights
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
31 |
32 | SYSTEM_PROMPT = '''You are solving IMO (International Mathematical Olympiad) problems - the most challenging mathematical competition …
|

E722 Do not use bare except
--> scripts/eval_math500_benchmark.py:112:5
|
110 | try:
111 | return abs(float(str1) - float(str2)) < 1e-10
112 | except:
| ^^^^^^
113 | return False
|

E722 Do not use bare except
--> scripts/eval_math500_benchmark.py:605:5
|
603 | logger.debug(f"Normalized as algebraic expression: {repr(result)}")
604 | return result
605 | except:
| ^^^^^^
606 | logger.debug("Failed to normalize as algebraic expression")
607 | pass
|

E722 Do not use bare except
--> scripts/eval_simpleqa_benchmark.py:201:25
|
199 | try:
200 | metadata = json.loads(row['metadata']) if row.get('metadata') else {}
201 | except:
| ^^^^^^
202 | metadata = {}
203 | question_id = i
|

F841 Local variable approaches is assigned to but never used
--> scripts/train_optillm_classifier.py:140:13
|
138 | input_ids = batch['input_ids'].to(device)
139 | attention_mask = batch['attention_mask'].to(device)
140 | approaches = batch['approaches'].to(device)
| ^^^^^^^^^^
141 | ranks = batch['ranks'].to(device)
142 | tokens = batch['tokens'].to(device)
|
help: Remove assignment to unused variable approaches

F841 Local variable approaches is assigned to but never used
--> scripts/train_optillm_classifier.py:203:13
|
201 | input_ids = batch['input_ids'].to(device)
202 | attention_mask = batch['attention_mask'].to(device)
203 | approaches = batch['approaches'].to(device)
| ^^^^^^^^^^
204 | ranks = batch['ranks'].to(device)
205 | tokens = batch['tokens'].to(device)
|
help: Remove assignment to unused variable approaches

F401 optillm.plugins.deepthink.SelfDiscover imported but unused; consider using importlib.util.find_spec to test for availability
--> tests/test_ci_quick.py:35:43
|
33 | # Test plugin subdirectory imports (critical for issue #220)
34 | try:
35 | from optillm.plugins.deepthink import SelfDiscover, UncertaintyRoutedCoT
| ^^^^^^^^^^^^
36 | from optillm.plugins.deep_research import DeepResearcher
37 | from optillm.plugins.longcepo import run_longcepo
|
help: Remove unused import

F401 optillm.plugins.deepthink.UncertaintyRoutedCoT imported but unused; consider using importlib.util.find_spec to test for availability
--> tests/test_ci_quick.py:35:57
|
33 | # Test plugin subdirectory imports (critical for issue #220)
34 | try:
35 | from optillm.plugins.deepthink import SelfDiscover, UncertaintyRoutedCoT
| ^^^^^^^^^^^^^^^^^^^^
36 | from optillm.plugins.deep_research import DeepResearcher
37 | from optillm.plugins.longcepo import run_longcepo
|
help: Remove unused import

F401 optillm.plugins.deep_research.DeepResearcher imported but unused; consider using importlib.util.find_spec to test for availability
--> tests/test_ci_quick.py:36:47
|
34 | try:
35 | from optillm.plugins.deepthink import SelfDiscover, UncertaintyRoutedCoT
36 | from optillm.plugins.deep_research import DeepResearcher
| ^^^^^^^^^^^^^^
37 | from optillm.plugins.longcepo import run_longcepo
38 | from optillm.plugins.spl import run_spl
|
help: Remove unused import: optillm.plugins.deep_research.DeepResearcher

F401 optillm.plugins.longcepo.run_longcepo imported but unused; consider using importlib.util.find_spec to test for availability
--> tests/test_ci_quick.py:37:42
|
35 | from optillm.plugins.deepthink import SelfDiscover, UncertaintyRoutedCoT
36 | from optillm.plugins.deep_research import DeepResearcher
37 | from optillm.plugins.longcepo import run_longcepo
| ^^^^^^^^^^^^
38 | from optillm.plugins.spl import run_spl
39 | from optillm.plugins.proxy import client, config, approach_handler
|
help: Remove unused import: optillm.plugins.longcepo.run_longcepo

F401 optillm.plugins.spl.run_spl imported but unused; consider using importlib.util.find_spec to test for availability
--> tests/test_ci_quick.py:38:37
|
36 | from optillm.plugins.deep_research import DeepResearcher
37 | from optillm.plugins.longcepo import run_longcepo
38 | from optillm.plugins.spl import run_spl
| ^^^^^^^
39 | from optillm.plugins.proxy import client, config, approach_handler
40 | print("✅ Plugin submodule imports working - no relative import errors")
|
help: Remove unused import: optillm.plugins.spl.run_spl

F401 optillm.plugins.proxy.client imported but unused; consider using importlib.util.find_spec to test for availability
--> tests/test_ci_quick.py:39:39
|
37 | from optillm.plugins.longcepo import run_longcepo
38 | from optillm.plugins.spl import run_spl
39 | from optillm.plugins.proxy import client, config, approach_handler
| ^^^^^^
40 | print("✅ Plugin submodule imports working - no relative import errors")
41 | except ImportError as e:
|
help: Remove unused import

F401 optillm.plugins.proxy.config imported but unused; consider using importlib.util.find_spec to test for availability
--> tests/test_ci_quick.py:39:47
|
37 | from optillm.plugins.longcepo import run_longcepo
38 | from optillm.plugins.spl import run_spl
39 | from optillm.plugins.proxy import client, config, approach_handler
| ^^^^^^
40 | print("✅ Plugin submodule imports working - no relative import errors")
41 | except ImportError as e:
|
help: Remove unused import

F401 optillm.plugins.proxy.approach_handler imported but unused; consider using importlib.util.find_spec to test for availability
--> tests/test_ci_quick.py:39:55
|
37 | from optillm.plugins.longcepo import run_longcepo
38 | from optillm.plugins.spl import run_spl
39 | from optillm.plugins.proxy import client, config, approach_handler
| ^^^^^^^^^^^^^^^^
40 | print("✅ Plugin submodule imports working - no relative import errors")
41 | except ImportError as e:
|
help: Remove unused import

F841 Local variable request_id2 is assigned to but never used
--> tests/test_conversation_logger.py:192:9
|
190 | # Test enabled logger stats with active conversations
191 | request_id1 = self.logger_enabled.start_conversation({}, "test", "model")
192 | request_id2 = self.logger_enabled.start_conversation({}, "test", "model")
| ^^^^^^^^^^^
193 |
194 | stats = self.logger_enabled.get_stats()
|
help: Remove assignment to unused variable request_id2

F841 Local variable found_relevant_entry is assigned to but never used
--> tests/test_conversation_logging_server.py:443:17
|
441 | for entry in entries:
442 | if "error logging scenarios" in str(entry.get("client_request", {})):
443 | found_relevant_entry = True
| ^^^^^^^^^^^^^^^^^^^^
444 | break
|
help: Remove assignment to unused variable found_relevant_entry

F401 optillm.deepconf.deepconf_decode imported but unused; consider using importlib.util.find_spec to test for availability
--> tests/test_deepconf.py:23:38
|
22 | try:
23 | from optillm.deepconf import deepconf_decode
| ^^^^^^^^^^^^^^^
24 | from optillm.deepconf.confidence import ConfidenceCalculator, ConfidenceThresholdCalibrator
25 | from optillm.deepconf.processor import DeepConfProcessor, TraceResult, DEFAULT_CONFIG
|
help: Remove unused import: optillm.deepconf.deepconf_decode

F401 optillm.deepconf.confidence.ConfidenceCalculator imported but unused; consider using importlib.util.find_spec to test for availability
--> tests/test_deepconf.py:24:49
|
22 | try:
23 | from optillm.deepconf import deepconf_decode
24 | from optillm.deepconf.confidence import ConfidenceCalculator, ConfidenceThresholdCalibrator
| ^^^^^^^^^^^^^^^^^^^^
25 | from optillm.deepconf.processor import DeepConfProcessor, TraceResult, DEFAULT_CONFIG
26 | logger.info("✓ All imports successful")
|
help: Remove unused import

F401 optillm.deepconf.confidence.ConfidenceThresholdCalibrator imported but unused; consider using importlib.util.find_spec to test for availability
--> tests/test_deepconf.py:24:71
|
22 | try:
23 | from optillm.deepconf import deepconf_decode
24 | from optillm.deepconf.confidence import ConfidenceCalculator, ConfidenceThresholdCalibrator
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
25 | from optillm.deepconf.processor import DeepConfProcessor, TraceResult, DEFAULT_CONFIG
26 | logger.info("✓ All imports successful")
|
help: Remove unused import

F401 optillm.deepconf.processor.DeepConfProcessor imported but unused; consider using importlib.util.find_spec to test for availability
--> tests/test_deepconf.py:25:48
|
23 | from optillm.deepconf import deepconf_decode
24 | from optillm.deepconf.confidence import ConfidenceCalculator, ConfidenceThresholdCalibrator
25 | from optillm.deepconf.processor import DeepConfProcessor, TraceResult, DEFAULT_CONFIG
| ^^^^^^^^^^^^^^^^^
26 | logger.info("✓ All imports successful")
27 | return True
|
help: Remove unused import

F401 optillm.deepconf.processor.TraceResult imported but unused; consider using importlib.util.find_spec to test for availability
--> tests/test_deepconf.py:25:67
|
23 | from optillm.deepconf import deepconf_decode
24 | from optillm.deepconf.confidence import ConfidenceCalculator, ConfidenceThresholdCalibrator
25 | from optillm.deepconf.processor import DeepConfProcessor, TraceResult, DEFAULT_CONFIG
| ^^^^^^^^^^^
26 | logger.info("✓ All imports successful")
27 | return True
|
help: Remove unused import

F401 optillm.deepconf.processor.DEFAULT_CONFIG imported but unused; consider using importlib.util.find_spec to test for availability
--> tests/test_deepconf.py:25:80
|
23 | from optillm.deepconf import deepconf_decode
24 | from optillm.deepconf.confidence import ConfidenceCalculator, ConfidenceThresholdCalibrator
25 | from optillm.deepconf.processor import DeepConfProcessor, TraceResult, DEFAULT_CONFIG
| ^^^^^^^^^^^^^^
26 | logger.info("✓ All imports successful")
27 | return True
|
help: Remove unused import

E712 Avoid equality comparisons to True; use info["local_models_only"]: for truth checks
--> tests/test_deepconf.py:154:16
|
152 | assert key in info, f"Missing key: {key}"
153 |
154 | assert info["local_models_only"] == True
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
155 | assert "low" in info["variants"] and "high" in info["variants"]
|
help: Replace with info["local_models_only"]

F841 Local variable start_time is assigned to but never used
--> tests/test_mars_imo25.py:31:9
|
29 | def chat_completions_create(self, **kwargs):
30 | """Mock completions.create with realistic IMO25 responses"""
31 | start_time = time.time()
| ^^^^^^^^^^
32 | time.sleep(self.response_delay)
33 | self.call_count += 1
|
help: Remove assignment to unused variable start_time

F841 Local variable start_time is assigned to but never used
--> tests/test_mars_parallel.py:33:9
|
31 | def chat_completions_create(self, **kwargs):
32 | """Mock completions.create with configurable delay"""
33 | start_time = time.time()
| ^^^^^^^^^^
34 | time.sleep(self.response_delay) # Simulate API call delay
35 | self.call_count += 1
|
help: Remove assignment to unused variable start_time

F841 Local variable server is assigned to but never used
--> tests/test_mcp_plugin.py:441:13
|
439 | )
440 |
441 | server = MCPServer("test", config)
| ^^^^^^
442 |
443 | # Test the header expansion logic from connect_sse method
|
help: Remove assignment to unused variable server

F401 spacy imported but unused; consider using importlib.util.find_spec to test for availability
--> tests/test_privacy_plugin_performance.py:92:20
|
90 | # Check if required dependencies are available
91 | try:
92 | import spacy
| ^^^^^
93 | from presidio_analyzer import AnalyzerEngine
94 | from presidio_anonymizer import AnonymizerEngine
|
help: Remove unused import: spacy

F401 presidio_analyzer.AnalyzerEngine imported but unused; consider using importlib.util.find_spec to test for availability
--> tests/test_privacy_plugin_performance.py:93:43
|
91 | try:
92 | import spacy
93 | from presidio_analyzer import AnalyzerEngine
| ^^^^^^^^^^^^^^
94 | from presidio_anonymizer import AnonymizerEngine
95 | except ImportError as e:
|
help: Remove unused import: presidio_analyzer.AnalyzerEngine

F401 presidio_anonymizer.AnonymizerEngine imported but unused; consider using importlib.util.find_spec to test for availability
--> tests/test_privacy_plugin_performance.py:94:45
|
92 | import spacy
93 | from presidio_analyzer import AnalyzerEngine
94 | from presidio_anonymizer import AnonymizerEngine
| ^^^^^^^^^^^^^^^^
95 | except ImportError as e:
96 | print(f"⚠️ Skipping performance test - dependencies not installed: {e}")
|
help: Remove unused import: presidio_anonymizer.AnonymizerEngine

F841 Local variable mock_openai is assigned to but never used
--> tests/test_ssl_config.py:110:48
|
108 | # Create client
109 | with patch('httpx.Client') as mock_httpx_client,
110 | patch('optillm.server.OpenAI') as mock_openai:
| ^^^^^^^^^^^
111 | get_config()
112 | # Verify httpx.Client was called with verify=False
|
help: Remove assignment to unused variable mock_openai

F841 Local variable mock_openai is assigned to but never used
--> tests/test_ssl_config.py:126:48
|
124 | # Create client
125 | with patch('httpx.Client') as mock_httpx_client,
126 | patch('optillm.server.OpenAI') as mock_openai:
| ^^^^^^^^^^^
127 | get_config()
128 | # Verify httpx.Client was called with verify=True
|
help: Remove assignment to unused variable mock_openai

F841 Local variable mock_openai is assigned to but never used
--> tests/test_ssl_config.py:143:48
|
141 | # Create client
142 | with patch('httpx.Client') as mock_httpx_client,
143 | patch('optillm.server.OpenAI') as mock_openai:
| ^^^^^^^^^^^
144 | get_config()
145 | # Verify httpx.Client was called with custom cert path
|
help: Remove assignment to unused variable mock_openai

F841 Local variable mock_httpx_client is assigned to but never used
--> tests/test_ssl_config.py:159:79
|
157 | mock_http_client_instance = MagicMock()
158 |
159 | with patch('httpx.Client', return_value=mock_http_client_instance) as mock_httpx_client,
| ^^^^^^^^^^^^^^^^^
160 | patch('optillm.server.OpenAI') as mock_openai:
161 | get_config()
|
help: Remove assignment to unused variable mock_httpx_client

F841 Local variable mock_httpx_client is assigned to but never used
--> tests/test_ssl_config.py:180:79
|
178 | mock_http_client_instance = MagicMock()
179 |
180 | with patch('httpx.Client', return_value=mock_http_client_instance) as mock_httpx_client,
| ^^^^^^^^^^^^^^^^^
181 | patch('optillm.server.Cerebras') as mock_cerebras:
182 | get_config()
|
help: Remove assignment to unused variable mock_httpx_client

F841 Local variable mock_httpx_client is assigned to but never used
--> tests/test_ssl_config.py:200:79
|
198 | mock_http_client_instance = MagicMock()
199 |
200 | with patch('httpx.Client', return_value=mock_http_client_instance) as mock_httpx_client,
| ^^^^^^^^^^^^^^^^^
201 | patch('optillm.server.AzureOpenAI') as mock_azure:
202 | get_config()
|
help: Remove assignment to unused variable mock_httpx_client

F841 Local variable mock_httpx_client is assigned to but never used
--> tests/test_ssl_config.py:318:39
|
316 | server_config['ssl_cert_path'] = ''
317 |
318 | with patch('httpx.Client') as mock_httpx_client,
| ^^^^^^^^^^^^^^^^^
319 | patch('optillm.server.OpenAI') as mock_openai,
320 | patch('optillm.server.logger.warning') as mock_logger_warning:
|
help: Remove assignment to unused variable mock_httpx_client

F841 Local variable mock_openai is assigned to but never used
--> tests/test_ssl_config.py:319:48
|
318 | with patch('httpx.Client') as mock_httpx_client,
319 | patch('optillm.server.OpenAI') as mock_openai,
| ^^^^^^^^^^^
320 | patch('optillm.server.logger.warning') as mock_logger_warning:
321 | get_config()
|
help: Remove assignment to unused variable mock_openai

F841 Local variable mock_httpx_client is assigned to but never used
--> tests/test_ssl_config.py:339:39
|
337 | server_config['ssl_cert_path'] = test_cert_path
338 |
339 | with patch('httpx.Client') as mock_httpx_client,
| ^^^^^^^^^^^^^^^^^
340 | patch('optillm.server.OpenAI') as mock_openai,
341 | patch('optillm.server.logger.info') as mock_logger_info:
|
help: Remove assignment to unused variable mock_httpx_client

F841 Local variable mock_openai is assigned to but never used
--> tests/test_ssl_config.py:340:48
|
339 | with patch('httpx.Client') as mock_httpx_client,
340 | patch('optillm.server.OpenAI') as mock_openai,
| ^^^^^^^^^^^
341 | patch('optillm.server.logger.info') as mock_logger_info:
342 | get_config()
|
help: Remove assignment to unused variable mock_openai

Found 353 errors (264 fixed, 89 remaining).
No fixes available (36 hidden fixes can be enabled with the --unsafe-fixes option).
(.venv) niko@agentic-tools:~/optillm$

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions