예제 #1
0
    def update():
        """
        Check for update
        :raise PackageError
        :return: str
        """

        try:
            if False is sys().is_windows:
                status = process.execute(CoreConfig.get('command').get('cvsupdate'))
                upd_status = tpl.line(status, color='green')
                msg = CoreConfig.get('update').format(status=upd_status)
            else:
                msg = CoreConfig.get('update').format(status=tpl.line(key='upd_win_stat'))
            return msg
        except (AttributeError, CoreSystemError) as error:
            raise PackageError(error)
예제 #2
0
    def update():
        """
        Check for update
        :raise PackageError
        :return: str
        """

        try:
            if False is sys().is_windows:
                status = process.execute(Config.params.get('cvsupdate'))
                upd_status = tpl.line(status, color='green')
                msg = Config.params.get('update').format(status=upd_status)
            else:
                msg = Config.params.get('update').format(status=tpl.line(key='upd_win_stat'))
            return msg
        except (AttributeError, CoreSystemError) as error:
            raise PackageError(error)
예제 #3
0
    def randomize_list(self, target, output):
        """
        Randomize scan list
        :param str target: target list
        :param str output: output list
        :raise ReaderError
        :return: None
        """

        try:

            target_file = self.__config.get(target)
            tmp_file = self.__config.get(output)
            output_file = filesystem.makefile(tmp_file)

            if False is sys().is_windows:
                process.execute('shuf {target} -o {output}'.format(target=target_file, output=output_file))
            else:
                filesystem.shuffle(target=target_file, output=output_file, total=self.total_lines)
        except (CoreSystemError, FileSystemError) as error:
            raise ReaderError(error)