예제 #1
0
 def generar_modulo_vba(vector_tuplas,
                        nombre_tabla,
                        nombre_campo_actualizar,
                        nombre_campo_condicion,
                        nombre_modulo,
                        campo_auxiliar=None):
     gf = GestorFicheros()
     vba = ""
     prefijo_funcion = "f_{0}"
     funcion_global = "\r\nPublic Function f_global()\r\n{0}\r\nEnd Function"
     funcion_parcial = "Public Function {0}(){1}\r\nEnd Function"
     max = 100  #Se generan funciones con este maximo de sentencias
     contador = 0
     num_funcion = 1
     vba_parcial = ""
     funciones = []
     while len(vector_tuplas) != 0:
         trozo = vector_tuplas[0:max]
         nombre_funcion = "f_" + str(num_funcion)
         vba_parcial += GeneradorVBA.generar_funcion(
             trozo, nombre_funcion, nombre_tabla, nombre_campo_actualizar,
             nombre_campo_condicion, campo_auxiliar)
         vector_tuplas = vector_tuplas[max:]
         funciones.append(nombre_funcion)
         num_funcion += 1
     vba_global = "\r\n".join(funciones)
     vba_resultado = vba_parcial + funcion_global.format(vba_global)
     return "Option Explicit\r\n" + vba_resultado
예제 #2
0
 def test_cuenta_lineas(self):
     gf = GestorFicheros()
     ficheros = [
         "fichero_ejemplo1.txt", "fichero_ejemplo2.txt",
         "fichero_ejemplo3.txt"
     ]
     for f in ficheros:
         num_lineas_segun_gf = gf.CountLines(f)
         num_lineas_segun_python = self.get_cantidad_lineas_fichero(f)
         self.assertEqual(num_lineas_segun_python, num_lineas_segun_gf)
예제 #3
0
#!/usr/bin/env python3
#coding=utf-8

from utilidades.ficheros.GestorFicheros import GestorFicheros
import glob, platform, sys, os

from datetime import date

hoy=date.today()
fecha_hoy=hoy.strftime("%Y%m%d")
print (fecha_hoy)


gf=GestorFicheros()

patrones=["al/*.html", "to/*.html"]

for p in patrones:
    ficheros_a_borrar=glob.glob(p)
    for f in ficheros_a_borrar:
        gf.borrar_fichero ( f )
        
FICHERO_RESULTADO="resultados" + os.sep +"resultados.html".format(fecha_hoy)

if platform.system()=="Linux":
    DESCARGADOR_AL      =   "./descargador_html_al.py"
    DESCARGADOR_TO      =   "./descargador_html_to.py"
    PROCESAR_ID_AL      =   "./procesar_id.py"
    PROCESAR_ID_TO      =   "./procesar_to.py"
    CREAR_ESTADISTICAS  =   "./crear_estadisticas.py"
else: