Skip to content

Commit 3618b26

Browse files
committed
credentials in test, exceptions pylintrc
1 parent a0a9f03 commit 3618b26

File tree

11 files changed

+43
-25
lines changed

11 files changed

+43
-25
lines changed

agents/matlab/.pylintrc

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -577,11 +577,4 @@ max-returns=6
577577
max-statements=50
578578

579579
# Minimum number of public methods for a class (see R0903).
580-
min-public-methods=1
581-
582-
583-
[EXCEPTIONS]
584-
585-
# Exceptions that will emit a warning when being caught. Defaults to
586-
# "BaseException, Exception".
587-
overgeneral-exceptions=builtins.BaseException,builtins.Exception
580+
min-public-methods=1

agents/matlab/matlab_agent/resources/use_matlab_agent.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ def start_listener(agent_identifier: str) -> None:
223223
# Send the simulation request to the Matlab agent via RabbitMQ.
224224
client.send_request(simulation_data)
225225

226-
# Keep the main thread alive to continue receiving asynchronous results.
226+
# Keep the main thread alive to continue receiving asynchronous
227+
# results.
227228
print("\nPress Ctrl+C to terminate the program...")
228229
while True:
229230
pass

agents/matlab/matlab_agent/src/core/batch.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,12 @@ def handle_batch_simulation(
9595
logger.info("Simulation '%s' completed successfully", sim_file)
9696

9797
except Exception as e: # pylint: disable=broad-except
98-
_handle_error(e, sim_file, rabbitmq_manager, source, response_templates)
98+
_handle_error(
99+
e,
100+
sim_file,
101+
rabbitmq_manager,
102+
source,
103+
response_templates)
99104
finally:
100105
# Always complete the operation to record metrics
101106
performance_monitor.complete_operation()

agents/matlab/matlab_agent/src/core/interactive.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ def accept(self) -> None:
6161
self._conn, _ = self._srv.accept()
6262
self._conn.setblocking(False)
6363
else:
64-
logger.error("[INTERACTIVE] Timeout waiting for client connection.")
64+
logger.error(
65+
"[INTERACTIVE] Timeout waiting for client connection.")
6566
raise TimeoutError("No client connection received in time.")
6667

6768
def send(self, data: Dict[str, Any]) -> None:
@@ -203,7 +204,9 @@ def _only_inputs(frame: Dict[str, Any]) -> Dict[str, Any]:
203204
if isinstance(frame, dict):
204205
sim = frame.get("simulation")
205206
if isinstance(sim, dict) and "inputs" in sim:
206-
logger.debug("[INTERACTIVE] Received inputs: %s", sim["inputs"])
207+
logger.debug(
208+
"[INTERACTIVE] Received inputs: %s",
209+
sim["inputs"])
207210
return sim["inputs"]
208211
return frame
209212

agents/matlab/matlab_agent/src/utils/config_manager.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,8 @@ def from_dict(cls, config_dict: Dict[str, Any]) -> 'Config':
219219
if tcp := config_dict.get("tcp", {}):
220220
flat_config["tcp_input_host"] = tcp.get("input_host", "localhost")
221221
flat_config["tcp_input_port"] = tcp.get("input_port", 5679)
222-
flat_config["tcp_output_host"] = tcp.get("output_host", "localhost")
222+
flat_config["tcp_output_host"] = tcp.get(
223+
"output_host", "localhost")
223224
flat_config["tcp_output_port"] = tcp.get("output_port", 5678)
224225

225226
# Extract response_templates section if present

agents/matlab/matlab_agent/src/utils/performance_monitor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,8 @@ def get_summary(self) -> Dict[str, float]:
256256

257257
startup_times = [
258258
m.matlab_startup_duration for m in self.metrics_history]
259-
simulation_times = [m.simulation_duration for m in self.metrics_history]
259+
simulation_times = [
260+
m.simulation_duration for m in self.metrics_history]
260261
total_times = [m.total_duration for m in self.metrics_history]
261262

262263
return {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
rabbitmq:
2+
host: localhost
3+
port: 5672
24
username: guest
35
password: guest

agents/matlab/matlab_agent/test/unit/test_config_loader.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,23 @@ def sample_config_dict(dummy_credentials):
3939

4040

4141
@pytest.fixture
42-
def sample_yaml_content():
42+
def sample_yaml_content(dummy_credentials):
4343
"""Return sample YAML content for testing."""
44-
return """
44+
rabbit_creds = dummy_credentials.get("rabbitmq", {})
45+
46+
host = rabbit_creds.get("host", "localhost")
47+
port = rabbit_creds.get("port", 5672)
48+
username = rabbit_creds.get("username", "guest")
49+
password = rabbit_creds.get("password", "guest")
50+
51+
return f"""
4552
agent:
4653
agent_id: matlab
4754
rabbitmq:
48-
host: "${HOSTNAME:localhost}"
49-
port: 5672
50-
username: "${USERNAME:xxxx}"
51-
password: "${PASSWORD:xxxx}"
55+
host: "{host}"
56+
port: {port}
57+
username: "{username}"
58+
password: "{password}"
5259
nested:
5360
deep:
5461
value: 42

agents/matlab/matlab_agent/test/unit/test_logger.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ def test_setup_logger_default_parameters(self):
6969
self.assertIsInstance(logger, logging.Logger)
7070
self.assertEqual(logger.name, self.logger_name)
7171
self.assertEqual(logger.level, DEFAULT_LOG_LEVEL)
72-
self.assertEqual(len(logger.handlers), 2) # File + Console handlers
72+
# File + Console handlers
73+
self.assertEqual(len(logger.handlers), 2)
7374

7475
# Close handlers before removing temp directory
7576
for handler in logger.handlers[:]:
@@ -105,7 +106,8 @@ def test_log_file_creation(self):
105106
)
106107

107108
self.assertTrue(os.path.exists(log_dir))
108-
# Log file might not exist until first write, but directory should exist
109+
# Log file might not exist until first write, but directory should
110+
# exist
109111

110112
def test_file_handler_configuration(self):
111113
"""Test file handler configuration."""

agents/matlab/matlab_agent/test/unit/test_main.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ def test_main_with_config_file(self, cli_runner, mock_dependencies):
112112
'logging': {'level': 'INFO', 'file': 'agent.log'}
113113
}
114114

115-
config_path = Path('matlab_agent/config/config.yaml.template').resolve()
115+
config_path = Path(
116+
'matlab_agent/config/config.yaml.template').resolve()
116117
result = cli_runner.invoke(main, ['-c', str(config_path)])
117118

118119
mock_load_config.assert_called_once_with(str(config_path))
@@ -512,7 +513,8 @@ def test_cli_short_config_option(self, cli_runner, mock_dependencies):
512513
'logging': {'level': 'INFO', 'file': 'test.log'}
513514
}
514515

515-
config_path = Path('matlab_agent/config/config.yaml.template').resolve()
516+
config_path = Path(
517+
'matlab_agent/config/config.yaml.template').resolve()
516518
result = cli_runner.invoke(main, ['-c', str(config_path)])
517519

518520
mock_load_config.assert_called_once_with(str(config_path))

0 commit comments

Comments
 (0)