Ejemplo n.º 1
0
def _parse_symbols(symbols):
    if not symbols:
        return tuple()
    if isinstance(symbols, string_types):
        return _symbols(symbols, seq=True)
    elif isinstance(symbols, Expr):
        return (symbols, )
    elif is_sequence(symbols):
        if all(isinstance(s, string_types) for s in symbols):
            return _symbols(symbols)
        elif all(isinstance(s, Expr) for s in symbols):
            return symbols
    raise ValueError("")
Ejemplo n.º 2
0
def _parse_symbols(symbols):
    if not symbols:
        return tuple()
    if isinstance(symbols, string_types):
        return _symbols(symbols, seq=True)
    elif isinstance(symbols, Expr):
        return (symbols,)
    elif is_sequence(symbols):
        if all(isinstance(s, string_types) for s in symbols):
            return _symbols(symbols)
        elif all(isinstance(s, Expr) for s in symbols):
            return symbols
    raise ValueError("")
Ejemplo n.º 3
0
def _parse_symbols(symbols):
    if not symbols:
        return tuple()
    if isinstance(symbols, string_types):
        return _symbols(symbols, seq=True)
    elif isinstance(symbols, Expr or FreeGroupElement):
        return (symbols, )
    elif is_sequence(symbols):
        if all(isinstance(s, string_types) for s in symbols):
            return _symbols(symbols)
        elif all(isinstance(s, Expr) for s in symbols):
            return symbols
    raise ValueError("The type of `symbols` must be one of the following: "
                     "a str, Symbol/Expr or a sequence of "
                     "one of these types")
Ejemplo n.º 4
0
def _parse_symbols(symbols):
    if not symbols:
        return tuple()
    if isinstance(symbols, string_types):
        return _symbols(symbols, seq=True)
    elif isinstance(symbols, Expr or FreeGroupElement):
        return (symbols,)
    elif is_sequence(symbols):
        if all(isinstance(s, string_types) for s in symbols):
            return _symbols(symbols)
        elif all(isinstance(s, Expr) for s in symbols):
            return symbols
    raise ValueError("The type of `symbols` must be one of the following: "
                     "a str, Symbol/Expr or a sequence of "
                     "one of these types")
Ejemplo n.º 5
0
def _parse_symbols(symbols):
    if not symbols:
        raise GeneratorsNeeded("generators weren't specified")

    if isinstance(symbols, basestring):
        return _symbols(symbols, seq=True)
    elif isinstance(symbols, Expr):
        return (symbols,)
    elif is_sequence(symbols):
        if all(isinstance(s, basestring) for s in symbols):
            return _symbols(symbols)
        elif all(isinstance(s, Expr) for s in symbols):
            return symbols

    raise GeneratorsError("expected a string, Symbol or expression or a non-empty sequence of strings, Symbols or expressions")