How to use the anypytools.tools.silentremove function in anypytools

To help you get started, we’ve selected a few anypytools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AnyBody-Research-Group / AnyPyTools / anypytools / abcutils.py View on Github external
def cleanup_logfiles(self, tasklist):
        for task in tasklist:
            try:
                if not self.keep_logfiles:
                    if not task.has_error() or task.retcode == _KILLED_BY_ANYPYTOOLS:
                        silentremove(task.logfile)
                        task.logfile = ""
            except OSError as e:
                logger.debug("Could not remove " "{} {}".format(task.logfile, str(e)))
            if not self.keep_logfiles and task.logfile:
                try:
                    macrofile = Path(task.logfile).with_suffix(".anymcr")
                    silentremove(macrofile)
                except OSError as e:
                    logger.debug(f"Could not remove: {macrofile} {e}")
github AnyBody-Research-Group / AnyPyTools / anypytools / abcutils.py View on Github external
task.processtime = time.time() - starttime
                except KeyboardInterrupt as e:
                    task.processtime = 0
                    raise e
                finally:
                    logfile.seek(0)

                task.output = parse_anybodycon_output(
                    logfile.read(),
                    self.ignore_errors,
                    self.warnings_to_include,
                    fatal_warnings=self.fatal_warnings,
                )
        finally:
            if not self.keep_logfiles and not task.has_error():
                silentremove(logfile.name)
                task.logfile = ""
            task_queue.put(task)
github AnyBody-Research-Group / AnyPyTools / anypytools / abcutils.py View on Github external
def cleanup_logfiles(self, tasklist):
        for task in tasklist:
            try:
                if not self.keep_logfiles:
                    if not task.has_error() or task.retcode == _KILLED_BY_ANYPYTOOLS:
                        silentremove(task.logfile)
                        task.logfile = ""
            except OSError as e:
                logger.debug("Could not remove " "{} {}".format(task.logfile, str(e)))
            if not self.keep_logfiles and task.logfile:
                try:
                    macrofile = Path(task.logfile).with_suffix(".anymcr")
                    silentremove(macrofile)
                except OSError as e:
                    logger.debug(f"Could not remove: {macrofile} {e}")
github AnyBody-Research-Group / AnyPyTools / anypytools / abcutils.py View on Github external
_subprocess_container.remove(proc.pid)
    retcode = ctypes.c_int32(proc.returncode).value
    if retcode == _KILLED_BY_ANYPYTOOLS:
        logfile.write("\nAnybodycon.exe was interrupted by AnyPyTools")
    elif retcode == _NO_LICENSES_AVAILABLE:
        logfile.write(
            "\nERROR: anybodycon.exe existed unexpectedly. "
            "Return code: " + str(_NO_LICENSES_AVAILABLE) + " : No license available."
        )
    elif retcode:
        logfile.write(
            "\nERROR: AnyPyTools : anybodycon.exe exited unexpectedly."
            " Return code: " + str(retcode)
        )
    if not keep_macrofile:
        silentremove(macro_file.name)
    return retcode