示例#1
0
def parse(env_str):
    '''
    Takes a string and returns a dict containing the parsed structure.
    This includes determination of whether the string is using the
    JSON or YAML format.
    '''
    try:
        env = yaml.load(env_str, Loader=yaml_loader)
    except yaml.YAMLError as yea:
        raise ValueError(yea)
    else:
        if env is None:
            env = {}

    for param in env:
        if param not in SECTIONS:
            raise ValueError(_('environment has wrong section "%s"') % param)

    return env
示例#2
0
def parse(env_str):
    '''
    Takes a string and returns a dict containing the parsed structure.
    '''
    if env_str is None:
        return {}

    try:
        env = yaml.load(env_str, Loader=yaml_loader)
    except yaml.YAMLError as yea:
        raise ValueError(yea)
    else:
        if env is None:
            env = {}

    for param in env:
        if param not in SECTIONS:
            raise ValueError(_('environment has wrong section "%s"') % param)

    return env
示例#3
0
def parse(env_str):
    """Takes a string and returns a dict containing the parsed structure."""
    if env_str is None:
        return {}

    try:
        env = yaml.load(env_str, Loader=yaml_loader)
    except yaml.YAMLError as yea:
        raise ValueError(yea)
    else:
        if env is None:
            env = {}

    if not isinstance(env, dict):
        raise ValueError(_('The environment is not a valid '
                           'YAML mapping data type.'))
    for param in env:
        if param not in SECTIONS:
            raise ValueError(_('environment has wrong section "%s"') % param)

    return env
示例#4
0
def parse(env_str):
    """Takes a string and returns a dict containing the parsed structure."""
    if env_str is None:
        return {}

    try:
        env = yaml.load(env_str, Loader=yaml_loader)
    except yaml.YAMLError as yea:
        raise ValueError(yea)
    else:
        if env is None:
            env = {}

    if not isinstance(env, dict):
        raise ValueError(
            _('The environment is not a valid '
              'YAML mapping data type.'))
    for param in env:
        if param not in SECTIONS:
            raise ValueError(_('environment has wrong section "%s"') % param)

    return env