def compare(self): errors = 0 for mod in self.res.keys(): if not self.merge_mods: logging.info(Colors.blue("Test on mod '%s'" % mod)) errors += self.check_one_mod(mod) total = len(self.expected) * len(self.res.keys()) return (errors, total)
def SetMessage(self, msg="Game"): self.msgSurfaceObj = self.fontObj.render(msg, False, Colors.blue()) self.msgRectobj = self.msgSurfaceObj.get_rect() self.msgRectobj.topleft = (self.width + 4, 0) # Clear previous msg self.surface.fill(Colors.white(), self.msgRectobj) self.surface.blit(self.msgSurfaceObj, self.msgRectobj)
def compare(self): total = 0 for pool in self.pools: total += len(pool.res) errors = 0 for i in range(0, len(self.pools)-1): p0 = self.pools[i] p1 = self.pools[i+1] min = p0.min max = p1.max p0_good = p0.res.filter_gt(self.field, max) p0_bad = p0.res.filter_le(self.field, max) p1_bad = p1.res.filter_ge(self.field, min) p1_good = p1.res.filter_lt(self.field, min) errors += len(p0_bad) + len(p1_bad) logging.warning(Colors.blue("Maps for %s and %s" % (str(p0), str(p1)))) logging.warning(p0_good.str_full(self.field, False, self.OK)) if len(p0_bad) + len(p1_bad) > 0: logging.warning(p0_bad.str_full(self.field, False, self.FAIL)) logging.warning(p1_bad.str_full(self.field, False, self.FAIL)) logging.warning(p1_good.str_full(self.field, False, self.OK)) return (errors, total)
def main(self): if not self.argv: logging.error("No test file!") return False # for arg in self.argv: try: logging.info(Colors.blue("Test on %s:" % arg)) err, tot = self.test(arg) self._errors += err self._total += tot except TR_Exception as e: logging.error(str(e)) # logging.info("") if self._errors == 0: logging.error(Colors.green("All test files passed! %d/%d" % (self._total - self._errors, self._total))) else: logging.error(Colors.fail("Some test files failed! %d/%d" % (self._total - self._errors, self._total))) # return self._errors == 0;
def cmd(cmd): if DEBUG: print(Colors.blue("Debug: '%s'" % cmd)) p = Popen(cmd, shell=True, universal_newlines=True, stdout=PIPE, stderr=PIPE, close_fds=True) return p.communicate()
def print_start(self): logging.info(Colors.blue("Starting test '%s'" % (self.name)))
PACKAGE_TEST_FOUND_NOT_CORRECT_FOLDER = "Encontró una carpeta inexistente" ST_ERROR = "[ERR]" ST_INFO = "[INF]" ST_WARNING = "[WRN]" ST_WARNING_ID = "[ERR][{0}]" VALIDATOR_ERROR_ON_RETRIEVE_PACKAGES = "Error al obtener los paquetes al validar" VALIDATOR_ERROR_ON_VALIDATE_WALK = "Error al validar la estructura en forma recursiva" VALIDATOR_ERROR_ON_VALIDATE_WALK_EXCEPTION = "Ha ocurrido un error en el walk recursivo" VALIDATOR_ERROR_ON_VALIDATE_WALK_RECURSIVE = "Error al validar la estructura en el llamado recursivo del walk" VALIDATOR_ERROR_STRUCTURE_FOLDER_DONT_EXIST = "El directorio definido para cargar la estructura valida no existe" VALIDATOR_ERROR_STRUCTURE_NOT_CREATED = "La estructura aun no se ha creado" VALIDATOR_TEST_ERROR_CHECK_HIERACHY_TREE = "Error al chequear el hierarchy tree" VALIDATOR_TEST_ERROR_INVALIDATE_CORRECT = "Error al invalidar un paquete correcto" VALIDATOR_TEST_ERROR_VALIDATE_EMPTY_BOTH = "Error al validar directorio y estructura vacíos" VALIDATOR_TEST_ERROR_VALIDATE_INCORRECT = "Error al validar un paquete incorrecto" WARNING_HEADER = COLOR.blue() + "[WARNING] " + COLOR.end() WARNING_NOCONFIGFOUND = "No se han encontrado configuraciones en el archivo '{0}'" WRAP_ERROR_MSG = 70 def create_msg(message, *args): """ Función que crea un mensaje de error dado argumentos iniciales. :param message: Código de error :type message: str :param args: Argumentos adicionales :type args: list :return: Mensaje de error :rtype: str
from banner import Banner from colors import Colors from bs4 import BeautifulSoup import re import requests import requests.exceptions from collections import deque except ImportError: print 'Install all required libraries' sys.exit(1) colors = Colors() RED = colors.red() GREEN = colors.green() BLUE = colors.blue() RESET = colors.reset() class EmailHarvester: def __init__(self, urls): self.urls = urls self.completed_urls = set() self.scrapped_emails = set() self.tmp_emails = set() def scrape_emails(self): try: while len(self.urls): url = self.urls.popleft() self.completed_urls.add(url)