all_switchs renvoie tous les switchs d'un batiment ou tous les switchs
manageables darcs-hash:20041005154719-d1718-5c43a5438c94730ad8755cd9ac337963bcddd2d2.gz
This commit is contained in:
parent
3f0d17b7b7
commit
6fad6b1ba8
1 changed files with 29 additions and 1 deletions
|
@ -1,5 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: iso8859-15 -*-
|
||||
# -*- coding: iso-8859-15 -*-
|
||||
|
||||
from types import *
|
||||
|
||||
# Liste des switchs
|
||||
bat_switchs = [ 'b', 'c' , 'h' , 'i' , 'g' , 'j' ]
|
||||
|
||||
aide={
|
||||
'g' : "appart du RDC=G901" ,
|
||||
|
@ -487,6 +492,29 @@ def reverse(bat) :
|
|||
else :
|
||||
reverse[prise] = [ chbre ]
|
||||
return reverse
|
||||
|
||||
def all_switchs(bat=None):
|
||||
"""Retourne la liste des switchs pour un batiment.
|
||||
|
||||
Si bat est donné, seulement pour le bâtiment demandé, sinon pour
|
||||
tous les bâtiments. bat peut être une liste aussi. Le backbone n'est
|
||||
pas pris en compte. La convention est batx-y sauf si y=0 et on a donc
|
||||
simplement batx"""
|
||||
if bat == None:
|
||||
bat = bat_switchs
|
||||
if not(type(bat) is TupleType or type(bat) is ListType):
|
||||
bat = [bat]
|
||||
switchs = []
|
||||
for b in map(lambda x: x.lower(), bat):
|
||||
dup = map(lambda x: x[1], reverse(b).keys())
|
||||
# dup contient des elements en double
|
||||
for n in list(dict(zip(dup,[None]*len(dup)))):
|
||||
if int(n) == 0:
|
||||
switchs.append("bat%s" % b)
|
||||
else:
|
||||
switchs.append("bat%s-%s" % (b, n))
|
||||
return switchs
|
||||
|
||||
|
||||
# Locaux clubs : lecture dans chbre_prises et ajout des locaux dans les bats non
|
||||
# manageables
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue