clearml_agent/helper/package/conda_api.py
def _run_command(self, command, raw=False, **kwargs):
        # type: (Iterable[Text], bool, Any) -> Union[Dict, Text]
        """
        Run a conda command, returning JSON output.
        The command is prepended with 'conda' and run with JSON output flags.
        :param command: command to run
        :param raw: return text output and don't change command
        :param kwargs: kwargs for Argv.get_output()
        :return: JSON output or text output
        """
        def escape_ansi(line):
            ansi_escape = re.compile(r'(?:\x1B[@-_]|[\x80-\x9F])[0-?]*[ -/]*[@-~]')
            return ansi_escape.sub('', line)

        # make sure we are not running it with our own PYTHONPATH
        env = dict(**os.environ)
        env.pop('PYTHONPATH', None)

        command = Argv(*command)  # type: Executable
        if not raw:
            command = (self.conda,) + command + ("--quiet", "--json")
        try:
            print('Executing Conda: {}'.format(command.serialize()))
            result = command.get_output(stdin=DEVNULL, env=env, **kwargs)
            if self.session.debug_mode:
                print(result)
        except Exception as e:
            result = e.output if hasattr(e, 'output') else ''
            if self.session.debug_mode:
                print(result)
            if raw:
                raise
        if raw:
            return result

        result = json.loads(escape_ansi(result)) if result else {}
        if result.get('success', False):
            print('Pass')
        elif result.get('error'):
            print('Conda error: {}'.format(result.get('error')))
        return result

        Run a conda command, returning JSON output.
        The command is prepended with 'conda' and run with JSON output flags.
        :param command: command to run
        :param raw: return text output and don't change command
        :param kwargs: kwargs for Argv.get_output()
        :return: JSON output or text output
        
Run a conda command, returning JSON output.
The command is prepended with 'conda' and run with JSON output flags.
Run a conda command returning JSON output . The command is prepended with ' conda ' and run with JSON output flags .
def _run_command(self, command, raw=False, **kwargs):
        def escape_ansi(line):
            ansi_escape = re.compile(r'(?:\x1B[@-_]|[\x80-\x9F])[0-?]*[ -/]*[@-~]')
            return ansi_escape.sub('', line)
        env = dict(**os.environ)
        env.pop('PYTHONPATH', None)
        command = Argv(*command)  
        if not raw:
            command = (self.conda,) + command + ("--quiet", "--json")
        try:
            print('Executing Conda: {}'.format(command.serialize()))
            result = command.get_output(stdin=DEVNULL, env=env, **kwargs)
            if self.session.debug_mode:
                print(result)
        except Exception as e:
            result = e.output if hasattr(e, 'output') else ''
            if self.session.debug_mode:
                print(result)
            if raw:
                raise
        if raw:
            return result
        result = json.loads(escape_ansi(result)) if result else {}
        if result.get('success', False):
            print('Pass')
        elif result.get('error'):
            print('Conda error: {}'.format(result.get('error')))
        return result
def _run_command ( self , command , raw = False , ** kwargs ) : def escape_ansi ( line ) : ansi_escape = re . compile ( r'(?:\x1B[@-_]|[\x80-\x9F])[0-?]*[ -/]*[@-~]' ) return ansi_escape . sub ( '' , line ) env = dict ( ** os . environ ) env . pop ( 'PYTHONPATH' , None ) command = Argv ( * command ) if not raw : command = ( self . conda , ) + command + ( "--quiet" , "--json" ) try : print ( 'Executing Conda: {}' . format ( command . serialize ( ) ) ) result = command . get_output ( stdin = DEVNULL , env = env , ** kwargs ) if self . session . debug_mode : print ( result ) except Exception as e : result = e . output if hasattr ( e , 'output' ) else '' if self . session . debug_mode : print ( result ) if raw : raise if raw : return result result = json . loads ( escape_ansi ( result ) ) if result else { } if result . get ( 'success' , False ) : print ( 'Pass' ) elif result . get ( 'error' ) : print ( 'Conda error: {}' . format ( result . get ( 'error' ) ) ) return result
Run a conda command, returning JSON output.
Run a conda command returning JSON output .
# type: (Iterable[Text], bool, Any) -> Union[Dict, Text] """
        Run a conda command, returning JSON output.
        The command is prepended with 'conda' and run with JSON output flags.
        :param command: command to run
        :param raw: return text output and don't change command
        :param kwargs: kwargs for Argv.get_output()
        :return: JSON output or text output
        """ # make sure we are not running it with our own PYTHONPATH # type: Executable
JSON output or text output
JSON output or text output
self
command
command to run
command to run
raw
return text output and don't change command
return text output and don ' t change command
kwargs
kwargs for Argv.get_output()
kwargs for Argv . get_output ()