Пример #1
0
    def __init__(self):
        """
        Constructor de la clase.

        :return: void
        :rtype: None
        """
        # Se instancian los super
        ExceptionBehaviour.__init__(self)
        VarTypedClass.__init__(self)

        # Carga de configuraciones
        core_config = ConfigLoader(DIR_CONFIG, "core.ini")
        validator_config = ConfigLoader(DIR_CONFIG, "validator.ini")
        self._doCheckStructureInSubfolder = validator_config.is_false("STRICT_MODE_PACKAGES")
        self._doRegexCaseInsensitive = validator_config.is_true("CASE_INSENSITIVE")
        self._verbose = core_config.is_true("VERBOSE")

        # Variables de estado
        self._isStructGenerated = False
        self._isValidStructureDirectories = True

        # Variables de la estructura
        self._structureBoolHierarchy = [False]
        self._structureBoolHierarchy2 = [False]
        self._structureDirectoryName = DIR_STRUCTURE_FOLDERNAME
        self._structureDirectoryRoot = DIR_DATA
        self._structurePackage = Package([])

        # Instancia un filemanager para generar la estructura
        self._fm = FileManager()
        self._fm.set_default_working_directory(self._structureDirectoryRoot)
        self._fm.restore_wd()
        self._fm.enable_auto_extract()
        self._fm.enable_do_remove_extracted_folders()
        self._fm.disable_remove_on_extract()
        self._fm.enable_restrict_characters()
        self._fm.enable_structure_characters()
        if self._verbose:
            self._fm.enable_verbose()
        else:
            self._fm.disable_verbose()

        # Variables de verificación
        self._validRegexChars = self._fm._get_valid_regex_chars()
Пример #2
0
# Main test
if __name__ == "__main__":
    # Importación de librerías
    # noinspection PyUnresolvedReferences
    from _testpath import *  # @UnusedWildImport
    from bin.configloader import ConfigLoader
    from bin.utils import compare_version, get_version, print_bars_console
    from config import DIR_CONFIG
    from bin import __version__

    # Arreglo de comparaciones
    versionDict = {1: ">", 2: "<", 0: "=="}

    # Se cargan las configuraciones del update
    print_bars_console("Cargando configuraciones")
    updateConfig = ConfigLoader(DIR_CONFIG, "updates.ini")
    label = str(updateConfig.get_value("LABEL"))
    web = updateConfig.get_value("WEB")
    header = str(updateConfig.get_value("HEADER"))
    print "Label a usar:", label
    print "Web cargada:", web
    print "Headers cargados:", header

    # Se carga la version web
    print_bars_console("Obteniendo version web")
    version = get_version(label, header, web)
    print "Version local:", __version__
    print "Version web:", version
    # noinspection SpellCheckingInspection
    print "Comparacion version (1) Local, (2) Web ===> (1)", versionDict[compare_version(__version__, version)], "(2)"
Пример #3
0
    def __init__(self, wd=DIR_UPLOADS):
        """
        Constructor de la clase.

        :param wd: Working directory, carpeta de trabajo sobre la cual se cargarán los distintos archivos
        :type wd: str

        :return: void
        :rtype: None
        """
        # Se instancian los super
        err.ExceptionBehaviour.__init__(self)
        VarTypedClass.__init__(self)

        # Carga de configuraciones
        config = ConfigLoader(DIR_CONFIG, "filemanager.ini")
        core_config = ConfigLoader(DIR_CONFIG, "core.ini")
        folder_config = ConfigLoader(DIR_CONFIG, "folder.ini")
        package_config = ConfigLoader(DIR_CONFIG, "packages.ini")

        # Parámetros de extracción
        self._autoExtract = config.is_true("AUTOEXTRACT")  # Auto extraer un archivo comprimido
        self._doRemoveExtractedFolders = config.is_true("DO_REMOVE_EXTRACTED_FOLDERS")
        self._extractIfFolderAlreadyExists = config.is_true("REPLACE_IF_FOLDER_ALREADY_EXISTS")
        if config.param_exists("RAR_EXTRACT_ENCODING"):
            self._rarFileEncoding = config.get_value("RAR_EXTRACT_ENCODING")
        else:
            self._rarFileEncoding = _DEFAULT_RAR_EXTRACT_ENCODING

        # Parámetros de exclusión
        self._ignoredFiles = folder_config.get_value_listed("IGNORE")
        self._removeOnExtract = config.is_true("REMOVE_ON_EXTRACT")

        # Parámetros de caracteres
        self._doCharactersRestricted = config.is_true("CHARACTERS_DO_RESTRICT")
        self._needDotOnFile = package_config.is_true("NEED_DOT_ON_FILE")
        self._validChars = package_config.get_value("VALID_CHARACTERS")
        self._validChars_rec = self._validChars
        self._validStructureChars = package_config.get_value("VALID_STRUCTURE_CHARACTERS")
        self._validRegexChars = package_config.get_value("VALID_REGEX_CHARACTERS")

        # Otros parámetros
        if package_config.param_exists("ENCODE"):
            self._fileEncoding = package_config.get_value("ENCODE")
        else:
            self._fileEncoding = _DEFAULT_FILE_ENCODING
        self._verbose = core_config.is_true("VERBOSE")

        # Variables del FD
        self._wd = wd
        self._defaultwd = DIR_UPLOADS
        self._lastExecutionExtractedFilelist = []
Пример #4
0
    print result

if doPlot:  # Se crea un gráfico de los resultados en función del tiempo
    _continue = False
    try:
        import matplotlib.pyplot as plt  # @UnresolvedImport @UnusedImport

        _continue = True
    except Exception, e:
        if verbose:
            # noinspection PyArgumentEqualDefault
            st_error(ERROR_MATPLOTLIB_NOT_INSTALLED, False, "runtests.py", e)
    if _continue:
        try:
            # Se obtienen las configuraciones
            plotConfig = ConfigLoader(DIR_CONFIG, "plot.ini")
            dpi_result = int(plotConfig.get_value("DPI", autoNumberify=True))
            max_data = int(plotConfig.get_value("NUMBER_OF_X_DATA", autoNumberify=True))
            max_range_var = float(plotConfig.get_value("MAX_RANGE_VAR", autoNumberify=True))
            y_range_max_coeff = float(plotConfig.get_value("Y_RANGE_COEF_FROM_MAX_VALUE", autoNumberify=True))

            # Se cargan los datos
            vec_time = []
            vec_test = []
            vec_ok = []
            vec_fail = []
            vec_x = []
            # noinspection PyArgumentEqualDefault
            testdata = open(DIR_TEST_RESULTS + RESULT_FILE, 'r')
            counter = 0
            for ln in testdata: