MCPcopy Create free account
hub / github.com/JasonLSC/GSCodec_Studio / F

Class F

examples/helper/STG/general_utils.py:216–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214def safe_state(silent):
215 old_f = sys.stdout
216 class F:
217 def __init__(self, silent):
218 self.silent = silent
219
220 def write(self, x):
221 if not self.silent:
222 if x.endswith("\n"):
223 old_f.write(x.replace("\n", " [{}]\n".format(str(datetime.now().strftime("%d/%m %H:%M:%S")))))
224 else:
225 old_f.write(x)
226
227 def flush(self):
228 old_f.flush()
229
230 sys.stdout = F(silent)
231

Callers 1

safe_stateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected