move colored printers into their own file

This commit is contained in:
Connor Olding 2023-05-07 06:33:02 -07:00
parent 9de5493e96
commit f0ea7750aa
4 changed files with 21 additions and 22 deletions

View file

@ -1,3 +1,5 @@
from .colors import *
from .prog80 import prog
from .utils import *
try:
@ -6,5 +8,3 @@ except ModuleNotFoundError:
pass
else:
from .utils_np import *
from .prog80 import prog

View file

@ -0,0 +1,18 @@
color_factory = lambda color: lambda s: print(f"\033[{color}m{s}\033[m")
m1 = color_factory(1)
m30 = color_factory(30)
m31 = color_factory(31)
m32 = color_factory(32)
m33 = color_factory(33)
m34 = color_factory(34)
m35 = color_factory(35)
m36 = color_factory(36)
m37 = color_factory(37)
m90 = color_factory(90)
m91 = color_factory(91)
m92 = color_factory(92)
m93 = color_factory(93)
m94 = color_factory(94)
m95 = color_factory(95)
m96 = color_factory(96)
m97 = color_factory(97)

View file

@ -6,25 +6,6 @@ tiniest = 2.0**-1022.0
check = object() # secret "key" to pass to wrap_untrustworthy to extract feval_count
final = object() # secret "key" to pass to wrap_untrustworthy to extract results
color_factory = lambda color: lambda s: print(f"\033[{color}m{s}\033[m")
m1 = color_factory(1)
m30 = color_factory(30)
m31 = color_factory(31)
m32 = color_factory(32)
m33 = color_factory(33)
m34 = color_factory(34)
m35 = color_factory(35)
m36 = color_factory(36)
m37 = color_factory(37)
m90 = color_factory(90)
m91 = color_factory(91)
m92 = color_factory(92)
m93 = color_factory(93)
m94 = color_factory(94)
m95 = color_factory(95)
m96 = color_factory(96)
m97 = color_factory(97)
class ExhaustedTrialsError(Exception):
pass

View file

@ -1,6 +1,6 @@
# i've separated numpy-dependent methods from the rest of the utils.
from . import AcquireForWriting, merge_summaries, feps, m33, m34, m93
from time import time
from .utils import AcquireForWriting, merge_summaries, feps, m33, m34, m93
import numpy as np