TheRealAIGuy commited on
Commit
a590d66
Β·
1 Parent(s): b36807d

Removed a suppressor that was suppressing a non-existent std::cout

Browse files
Files changed (1) hide show
  1. server/fin_auditor_environment.py +2 -23
server/fin_auditor_environment.py CHANGED
@@ -11,30 +11,11 @@ Wraps the compiled C++ ``hft_auditor.ReconciliationEngine``.
11
 
12
  import os
13
  import sys
14
- import contextlib
15
  import glob
16
  import importlib.util
17
  from uuid import uuid4
18
  import numpy as np
19
 
20
- @contextlib.contextmanager
21
- def suppress_stdout():
22
- """Silence low-level C-level stdout AND stderr (printf, std::cout, std::cerr) using fd redirection."""
23
- with open(os.devnull, "w") as devnull:
24
- # Save originals
25
- old_stdout_fd = os.dup(1)
26
- old_stderr_fd = os.dup(2)
27
- # Redirect both
28
- os.dup2(devnull.fileno(), 1)
29
- os.dup2(devnull.fileno(), 2)
30
- try:
31
- yield
32
- finally:
33
- # Restore originals
34
- os.dup2(old_stdout_fd, 1)
35
- os.dup2(old_stderr_fd, 2)
36
- os.close(old_stdout_fd)
37
- os.close(old_stderr_fd)
38
 
39
  # ── Native Engine Bridge ─────────────────────────────────────────────────────
40
  def _load_native_engine():
@@ -75,8 +56,7 @@ def _load_native_engine():
75
  print(f"[CRITICAL] Native loading failed: {e}")
76
  return None
77
 
78
- with suppress_stdout():
79
- hft_auditor = _load_native_engine()
80
  # ─────────────────────────────────────────────────────────────────────────────
81
 
82
  from typing import Any, Dict, Optional
@@ -100,8 +80,7 @@ class FinAuditorEnvironment(Environment):
100
 
101
  def __init__(self) -> None:
102
  self._state = State(episode_id=str(uuid4()), step_count=0)
103
- with suppress_stdout():
104
- self.engine = hft_auditor.ReconciliationEngine(self._RING_BUFFER_CAPACITY)
105
  self.sim_time_ns = 0
106
 
107
  # We default to HARD, but the actual routing happens in reset()
 
11
 
12
  import os
13
  import sys
 
14
  import glob
15
  import importlib.util
16
  from uuid import uuid4
17
  import numpy as np
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
  # ── Native Engine Bridge ─────────────────────────────────────────────────────
21
  def _load_native_engine():
 
56
  print(f"[CRITICAL] Native loading failed: {e}")
57
  return None
58
 
59
+ hft_auditor = _load_native_engine()
 
60
  # ─────────────────────────────────────────────────────────────────────────────
61
 
62
  from typing import Any, Dict, Optional
 
80
 
81
  def __init__(self) -> None:
82
  self._state = State(episode_id=str(uuid4()), step_count=0)
83
+ self.engine = hft_auditor.ReconciliationEngine(self._RING_BUFFER_CAPACITY)
 
84
  self.sim_time_ns = 0
85
 
86
  # We default to HARD, but the actual routing happens in reset()