Ejemplo n.º 1
0
 def __init__(
     self,
     true: str = DEFAULT_TRUE_STR,
     false: str = DEFAULT_FALSE_STR,
     align_right: bool = False,
     min_len: Union[int, Auto] = AUTO,
     max_len: Union[int, Auto] = AUTO,
     including_framing: bool = False,
     crop: str = SHORT_CROP_SUFFIX,
     fill: str = FILL_CHAR,
     prefix: str = '',
     suffix: str = '',
     default: str = DEFAULT_STR,
 ):
     max_len = Auto.acquire(
         max_len,
         max(len(true), len(false), len(default), len(crop),
             Auto.acquire(min_len, 0)))
     min_len = Auto.acquire(min_len, max_len)
     self._true = true
     self._false = false
     super().__init__(
         min_len=min_len,
         max_len=max_len,
         including_framing=including_framing,
         fill=fill,
         crop=crop,
         prefix=prefix,
         suffix=suffix,
         align_right=align_right,
         default=default,
     )
Ejemplo n.º 2
0
 def __init__(self, name: Name, value: Union[Value, Auto] = AUTO, update: bool = False):
     if update or not self._is_initialized():
         name = get_name(name)
         if self._auto_value:
             value = Auto.acquire(value, name)
         self.name = name
         self.value = value
Ejemplo n.º 3
0
def acquire(current, default, delayed=False, *args, **kwargs):
    return Auto.acquire(current, default, delayed=delayed, *args, **kwargs)