sandbox/executor.py
def from_config(cls, config: dict) -> List['Command']:
        """Extract commands from the config dictionary, returning a list of Commands."""
        if 'commands' not in config:
            raise HTTPExceptions.BAD_REQUEST.with_content("Missing field 'commands' in config")
        
        if not isinstance(config["commands"], list):
            raise HTTPExceptions.BAD_REQUEST.with_content(
                f'commands must be a list, not {type(config["commands"])}'
            )
        
        environ = utils.parse_environ(config)
        if not config["commands"]:
            raise HTTPExceptions.BAD_REQUEST.with_content(f"Command list cannot be empty")
        
        commands = list()
        for c in config["commands"]:
            if isinstance(c, dict) and cls._check(c):
                commands.append(Command(environ=environ, **c))
            elif isinstance(c, str):
                commands.append(Command(c, environ=environ))
            else:
                raise HTTPExceptions.BAD_REQUEST.with_content(f"Command badly formatted : '{c}'")
        
        return commands
Extract commands from the config dictionary, returning a list of Commands.
Extract commands from the config dictionary, returning a list of Commands.
Extract commands from the config dictionary returning a list of Commands .
def from_config(cls, config: dict) -> List['Command']:
        if 'commands' not in config:
            raise HTTPExceptions.BAD_REQUEST.with_content("Missing field 'commands' in config")
        if not isinstance(config["commands"], list):
            raise HTTPExceptions.BAD_REQUEST.with_content(
                f'commands must be a list, not {type(config["commands"])}'
            )
        environ = utils.parse_environ(config)
        if not config["commands"]:
            raise HTTPExceptions.BAD_REQUEST.with_content(f"Command list cannot be empty")
        commands = list()
        for c in config["commands"]:
            if isinstance(c, dict) and cls._check(c):
                commands.append(Command(environ=environ, **c))
            elif isinstance(c, str):
                commands.append(Command(c, environ=environ))
            else:
                raise HTTPExceptions.BAD_REQUEST.with_content(f"Command badly formatted : '{c}'")
        return commands
def from_config ( cls , config : dict ) -> List [ 'Command' ] : if 'commands' not in config : raise HTTPExceptions . BAD_REQUEST . with_content ( "Missing field 'commands' in config" ) if not isinstance ( config [ "commands" ] , list ) : raise HTTPExceptions . BAD_REQUEST . with_content ( f'commands must be a list, not {type(config["commands"])}' ) environ = utils . parse_environ ( config ) if not config [ "commands" ] : raise HTTPExceptions . BAD_REQUEST . with_content ( f"Command list cannot be empty" ) commands = list ( ) for c in config [ "commands" ] : if isinstance ( c , dict ) and cls . _check ( c ) : commands . append ( Command ( environ = environ , ** c ) ) elif isinstance ( c , str ) : commands . append ( Command ( c , environ = environ ) ) else : raise HTTPExceptions . BAD_REQUEST . with_content ( f"Command badly formatted : '{c}'" ) return commands
Extract commands from the config dictionary, returning a list of Commands.
Extract commands from the config dictionary returning a list of Commands .
"""Extract commands from the config dictionary, returning a list of Commands."""
cls
config
dict