def calculaPeso(self,idCamion,peso,unManejador):
     if type(idCamion) == int:
         if type(peso) == float:
             aux = ManejadorCamion()
             if type(aux) == type(unManejador):
                 unCamion = Camion()
                 listaCamiones = unManejador.getListaCamiones()
                 for unCamion in listaCamiones:
                     if unCamion.getIdCamion() == idCamion:
                         tara = unCamion.getTara()
                         kilos = peso - tara
                 return kilos
 def listadoDia(self,dia,unManejador,unaCosecha):
     if type(dia) == int:
         aux=ManejadorCamion()
         if type(aux) == type(unManejador):
             aux=Cosecha()
             if type(aux) == type(unaCosecha):
                 print ('PATENTE\t\tConductor\tKilos\n')
                 listaCamiones = unManejador.getListaCamiones()
                 unCamion = Camion()
                 for unCamion in listaCamiones:
                     patente = unCamion.getPatente()
                     conductor = unCamion.getConductor()
                     idCamion = unCamion.getIdCamion()
                     kilos = self.calculoTotal(idCamion-1,unaCosecha)
                     print (f'{patente}\t\t{conductor}\t\t{kilos}')
 def verificaPeso(self,idCamion,peso, unManejador): #Previamente se verificó unManejador
     if type(idCamion) == int:
         if type(peso) == float:
             aux = ManejadorCamion()
             if type(aux) == type(unManejador):
                 unCamion = Camion()
                 listaCamiones = unManejador.getListaCamiones()
                 for unCamion in listaCamiones:
                     if unCamion.getIdCamion() == idCamion:
                         tara = unCamion.getTara()
                         if peso >= tara:
                             retorno=True
                         else:
                             retorno=False
                         return retorno
 def addCamion(self, id, nombre, patente, marca, tara):
     if id.isdigit() and tara.isdigit():
         id = int(id)
         tara = int(tara)
         if re.search(
                 r'[\d\_\-\.+*]',
                 nombre) != None:  #busco numeros o simbolos en el nombre
             print(
                 'Error al ingresar el nombre. Este debe contener solo letras'
             )
         elif re.search(r'[A-Z]{2}[\d]{3}[A-Z]{2}', patente) == None:
             print(
                 'Error al ingresar la patente, esta debe tener formato AA111AA'
             )
         elif re.search(r'[\d\_\-\.+*]', marca) != None:
             print(
                 'Error al ingresar la marca. Este debe contener solo letras'
             )
         elif id <= 0 or id > 20:
             print('El identificador debe ser de 1 a 20')
         else:
             newCamion = Camion(id, nombre, patente, marca, tara)
             self.__listaCamiones.append(newCamion)
     else:
         print('Error: identificador y tara deben ser un numero entero.')
 def testCamion(self):
     archivo = open("Camion.csv")
     reader = csv.reader(archivo, delimiter=";")
     bandera = True
     for fila in reader:
         if bandera:
             bandera = not bandera
         else:
             ide = int(fila[0])
             nom = fila[1]
             pat = fila[2]
             marca = fila[3]
             tara = fila[4]
             unCamion = Camion(ide, nom, pat, marca, tara)
             self.agregarCamion(unCamion)
             #self.mostrarelemento()
     archivo.close()
 def leerArchivo(self):
     os.system('cls')
     archivo = open('camiones.csv')
     reader = csv.reader(archivo, delimiter=';')
     bandera = True
     for fila in reader:
         if bandera:
             ''' Saltear bandera'''
             bandera = False
         else:
             idCamion = int(fila[0])
             nombreConductor = fila[1]
             patente = fila[2]
             marca = fila[3]
             tara = float(fila[4])
             unCamion = Camion(idCamion, nombreConductor, patente, marca,
                               tara)
             self.agregaCamion(unCamion)
     archivo.close()
 def __str__(self):
     s = ''
     unCamion = Camion()
     for unCamion in self.__lista:
         s += unCamion.__str__() + '\n\n'
     return s
 def agregaCamion(self, unCamion):
     aux = Camion()
     if type(aux) == type(unCamion):
         self.__lista.append(unCamion)