Exemple #1
0
    def __init__(self, C, CIC, file_edi, file_corsi, map_corsi):
        self.edi = SchemaXls(file_edi)
        self.corsi = SchemaXls(file_corsi)
        self.map_corsi = map_corsi
        self.n_c = len(C)
        self.n_e = len(Sede.map_sedi)
        self.corsi_edi = np.array([0 for i in xrange(self.n_c * self.n_e)
                                   ]).reshape((self.n_c, self.n_e))

        CIC_union = [c for C_ in CIC for c in C_]
        for c in CIC_union:
            l = self.get_cod(c)
            e = self.get_e(l)
            self.corsi_edi[c, e] = 1
Exemple #2
0
    def __init__(self, file_):
        self.dati = SchemaXls(file_)
        self.ncol = self.dati.ncol - 1
        self.nrow = self.dati.nrow - 1
        self.tab_pesi = np.array([0 for i in xrange(self.nrow * self.ncol)
                                  ]).reshape((self.ncol, self.nrow))
        self.day = range(self.ncol)
        self.hour = range(self.nrow)

        self.day_nome = {}
        for k, v in self.dati.schema.items():
            if k == None or k == '':
                continue

            self.day_nome[k] = v - 1

        self.hour_nome = {}
        i = 0
        for r in self.dati.get_rows_list():
            date = xldate_as_tuple(r[0].value, 0)
            ora = '{:02d}:{:02d}'.format(date[3], date[4])
            self.hour_nome[ora] = i
            i = i + 1

        for i in self.day:
            for j in self.hour:
                self.tab_pesi[i, j] = self.dati.sheet.cell(j + 1, i + 1).value
Exemple #3
0
    def __init__(self, file_):
        self.dati = SchemaXls(file_)
        self.aule = []

        aule = self.dati.get_rows_list_schema()

        for a in aule:
            att = {}
            for k, v in a.items():
                if k == 'NOME' or k == 'SEDE' or k == 'CAPIENZA':
                    continue
                if v.upper() == 'SI':
                    att[k] = v

            item = Aula(a['NOME'], a['SEDE'], a['CAPIENZA'], att)
            self.aule.append(item)
Exemple #4
0
    def __init__(self, file_, map_corsi, meta):
        self.dati = SchemaXls(file_)
        self.map = map_corsi
        self.meta = meta
        self.rows = self.dati.get_rows_list_schema()

        self.lista_disp = []
        self.dict_disp = {}
        for r in self.rows:
            corsi = self.get_corsi_prof(r['PROF'])
            d = self.get_n_giorno(r['GIORNO'])
            lista_h = self.get_n_ora(r['DALLE'], r['ALLE'])
            self.aggiungi_dict(r['PROF'], d, lista_h)
            for c in corsi:
                for h in lista_h:
                    tupla = (c, d, h)
                    self.lista_disp.append(tupla)
Exemple #5
0
 def __init__(self, file_, meta):
     self.dati = SchemaXls(file_)
     self.meta = meta
     self.semestre = int(
         self.dati.get_campo_where('Valore', Parametro='semestre'))
     self.pranzo = self.dati.get_campo_where(
         'Valore', Parametro='ora fine pausa pranzo')
     self.cap = self.dati.get_campo_where('Valore',
                                          Parametro='valore capienza aule')
     self.att = self.dati.get_campo_where('Valore',
                                          Parametro='valore attrezzature')
     self.sov = self.dati.get_campo_where(
         'Valore', Parametro='valore sovrapposizione corsi')
     self.edi = self.dati.get_campo_where('Valore',
                                          Parametro='valore edifici')
     self.comp = self.dati.get_campo_where(
         'Valore', Parametro='valore compattezza orario')
Exemple #6
0
    def __init__(self, C, schema_aule, file_, dict_):
        self.dati = SchemaXls(file_)
        self.schema = dict(
            (k.upper(), v) for k, v in self.dati.schema.iteritems())
        self.dict = dict_
        self.n_c = len(C)
        self.n_att = len(schema_aule.get_set_att())
        self.corsi_att = np.array([0 for i in xrange(self.n_att * self.n_c)
                                   ]).reshape((self.n_c, self.n_att))
        self.list_att = Aula.map_att.keys()
        self.list_col_att = dict(
            (a, self.schema[a] - 2) for a in self.list_att)

        for k, block_list in self.dict.items():
            for block in block_list:
                for att in self.list_att:
                    c = block['index']
                    t = Aula.get_n_att(att)
                    if 'S' in block['att'][self.list_col_att[att]].upper():
                        self.corsi_att[c, t] = 1