qcodes/dataset/guid_helpers.py
def guids_from_list_str(s: str) -> Optional[Tuple[str, ...]]:
    """
    Get tuple of guids from a python/json string representation of a list.

    Extracts the guids from a string representation of a list, tuple,
    or set of guids or a single guid.

    Args:
        s: input string

    Returns:
        Extracted guids as a tuple of strings.
        If a provided string does not match the format, `None` will be returned.
        For an empty list/tuple/set or empty string an empty tuple is returned.

    Examples:
        >>> guids_from_str(
        "['07fd7195-c51e-44d6-a085-fa8274cf00d6', \
          '070d7195-c51e-44d6-a085-fa8274cf00d6']")
        will return
        ('07fd7195-c51e-44d6-a085-fa8274cf00d6',
        '070d7195-c51e-44d6-a085-fa8274cf00d6')
    """
    if s == "":
        return tuple()

    try:
        validate_guid_format(s)
        return (s,)
    except ValueError:
        pass

    try:
        parsed_expression = ast.parse(s, mode='eval')
    except SyntaxError:
        return None

    if not hasattr(parsed_expression, 'body'):
        return None

    parsed = cast(ast.Expression, parsed_expression).body

    if isinstance(parsed, ast.Str):
        if len(parsed.s) > 0:
            return (parsed.s,)
        else:
            return tuple()

    if not isinstance(parsed, (ast.List, ast.Tuple, ast.Set)):
        return None

    if not all(isinstance(e, ast.Str) for e in parsed.elts):
        return None

    str_elts = cast(Tuple[ast.Str, ...], tuple(parsed.elts))
    return tuple(s.s for s in str_elts)

    Get tuple of guids from a python/json string representation of a list.

    Extracts the guids from a string representation of a list, tuple,
    or set of guids or a single guid.

    Args:
        s: input string

    Returns:
        Extracted guids as a tuple of strings.
        If a provided string does not match the format, `None` will be returned.
        For an empty list/tuple/set or empty string an empty tuple is returned.

    Examples:
        >>> guids_from_str(
        "['07fd7195-c51e-44d6-a085-fa8274cf00d6', \
          '070d7195-c51e-44d6-a085-fa8274cf00d6']")
        will return
        ('07fd7195-c51e-44d6-a085-fa8274cf00d6',
        '070d7195-c51e-44d6-a085-fa8274cf00d6')
    
Get tuple of guids from a python/json string representation of a list.
Extracts the guids from a string representation of a list, tuple,
or set of guids or a single guid.
Get tuple of guids from a python / json string representation of a list . Extracts the guids from a string representation of a list tuple or set of guids or a single guid .
def guids_from_list_str(s: str) -> Optional[Tuple[str, ...]]:
    if s == "":
        return tuple()
    try:
        validate_guid_format(s)
        return (s,)
    except ValueError:
        pass
    try:
        parsed_expression = ast.parse(s, mode='eval')
    except SyntaxError:
        return None
    if not hasattr(parsed_expression, 'body'):
        return None
    parsed = cast(ast.Expression, parsed_expression).body
    if isinstance(parsed, ast.Str):
        if len(parsed.s) > 0:
            return (parsed.s,)
        else:
            return tuple()
    if not isinstance(parsed, (ast.List, ast.Tuple, ast.Set)):
        return None
    if not all(isinstance(e, ast.Str) for e in parsed.elts):
        return None
    str_elts = cast(Tuple[ast.Str, ...], tuple(parsed.elts))
    return tuple(s.s for s in str_elts)
def guids_from_list_str ( s : str ) -> Optional [ Tuple [ str , ... ] ] : if s == "" : return tuple ( ) try : validate_guid_format ( s ) return ( s , ) except ValueError : pass try : parsed_expression = ast . parse ( s , mode = 'eval' ) except SyntaxError : return None if not hasattr ( parsed_expression , 'body' ) : return None parsed = cast ( ast . Expression , parsed_expression ) . body if isinstance ( parsed , ast . Str ) : if len ( parsed . s ) > 0 : return ( parsed . s , ) else : return tuple ( ) if not isinstance ( parsed , ( ast . List , ast . Tuple , ast . Set ) ) : return None if not all ( isinstance ( e , ast . Str ) for e in parsed . elts ) : return None str_elts = cast ( Tuple [ ast . Str , ... ] , tuple ( parsed . elts ) ) return tuple ( s . s for s in str_elts )
Get tuple of guids from a python/json string representation of a list.
Get tuple of guids from a python / json string representation of a list .
"""
    Get tuple of guids from a python/json string representation of a list.

    Extracts the guids from a string representation of a list, tuple,
    or set of guids or a single guid.

    Args:
        s: input string

    Returns:
        Extracted guids as a tuple of strings.
        If a provided string does not match the format, `None` will be returned.
        For an empty list/tuple/set or empty string an empty tuple is returned.

    Examples:
        >>> guids_from_str(
        "['07fd7195-c51e-44d6-a085-fa8274cf00d6', \
          '070d7195-c51e-44d6-a085-fa8274cf00d6']")
        will return
        ('07fd7195-c51e-44d6-a085-fa8274cf00d6',
        '070d7195-c51e-44d6-a085-fa8274cf00d6')
    """
Extracted guids as a tuple of strings.
If a provided string does not match the format, `None` will be returned.
For an empty list/tuple/set or empty string an empty tuple is returned.
Extracted guids as a tuple of strings . If a provided string does not match the format ` None ` will be returned . For an empty list / tuple / set or empty string an empty tuple is returned .
s
str
None
examples
None