MCPcopy Index your code
hub / github.com/bayesian-optimization/BayesianOptimization / to_string

Method to_string

bayes_opt/parameter.py:128–147  ·  view source on GitHub ↗

Represent a parameter value as a string. Parameters ---------- value : Any The value to represent. str_len : int The maximum length of the string representation. Returns ------- str

(self, value: Any, str_len: int)

Source from the content-addressed store, hash-verified

126 """
127
128 def to_string(self, value: Any, str_len: int) -> str:
129 """Represent a parameter value as a string.
130
131 Parameters
132 ----------
133 value : Any
134 The value to represent.
135
136 str_len : int
137 The maximum length of the string representation.
138
139 Returns
140 -------
141 str
142 """
143 s = f"{value:<{str_len}}"
144
145 if len(s) > str_len:
146 return s[: str_len - 3] + "..."
147 return s
148
149 @property
150 @abc.abstractmethod

Callers 1

_print_stepMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected