Exemplo n.º 1
0
 def __repr__(self):
     return util.make_repr(
         "DataLoader",
         seed=self.seed,
         iterations=self.iterations,
         input_metadata=self.user_input_metadata or None,
         int_range=self.int_range,
         float_range=self.float_range,
         val_range=self.val_range,
     )[0]
Exemplo n.º 2
0
 def __repr__(self):
     return util.make_repr(
         "Calibrator",
         data_loader,
         cache=cache,
         BaseClass=BaseClass,
         batch_size=batch_size,
         quantile=quantile,
         regression_cutoff=regression_cutoff,
         algo=algo,
     )[0]
Exemplo n.º 3
0
def make_invocable_impl(type_str, *args, **kwargs):
    """
    Generates a string that would invoke the type specified in
    type_str with the specified arguments.
    Skips keyword arguments that are set to ``None``.

    For example, ``make_invocable_impl("Example", None, "string", w=None, x=2, y=inline("test"))``
    would return a string: ``"Example(None, 'string', x=2, y=test)"``

    Args:
        type_str (str):
                The type to invoke.

    Returns:
        Tuple[str, bool]:
                A tuple including the `invoke` string and a boolean
                indicating whether all the arguments were default (i.e. None).
    """
    # We don't need to check obj_str for safety since we know that any inline
    # args/kwargs are already safe - other types need no checks
    obj_str, all_defaults = util.make_repr(type_str, *args, **kwargs)
    return Script.String(obj_str, safe=True, inline=True), all_defaults