(*args: Union[str, Union[Sweep]], sweep: Optional[Sweep] = None)
Tags the sweep with a list of string tags.
Tags the sweep with a list of string tags.
Tags the sweep with a list of string tags .
def tag(*args: Union[str, Union[Sweep]], sweep: Optional[Sweep] = None) -> Sweep:
    """
    Tags the sweep with a list of string tags.
    """
    if len(args) < 1:
        raise ValueError("Not enough arguments to tag, must take at least a sweep")

    if sweep is not None:
        return tag(*(list(args) + [sweep]))

    last = args[-1]
    if isinstance(last, Sweep):
        sweep = last
        tags = set()
        for tag_ in args[0:-1]:
            if not isinstance(tag_, str):
                raise ValueError(
                    f"tag arguments type must be string, got {type(tag_).__name__}"
                )
            tags.add(tag_)
        sweep.tags = tags
        return sweep
    else:
        raise ValueError(
            f"Last argument to tag() must be a choice(), range() or interval(), got {type(sweep).__name__}"
        )
def tag ( * args : Union [ str , Union [ Sweep ] ] , sweep : Optional [ Sweep ] = None ) -> Sweep : if len ( args ) < 1 : raise ValueError ( "Not enough arguments to tag, must take at least a sweep" ) if sweep is not None : return tag ( * ( list ( args ) + [ sweep ] ) ) last = args [ - 1 ] if isinstance ( last , Sweep ) : sweep = last tags = set ( ) for tag_ in args [ 0 : - 1 ] : if not isinstance ( tag_ , str ) : raise ValueError ( f"tag arguments type must be string, got {type(tag_).__name__}" ) tags . add ( tag_ ) sweep . tags = tags return sweep else : raise ValueError ( f"Last argument to tag() must be a choice(), range() or interval(), got {type(sweep).__name__}" )