1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
# Recupere le prototype de la fonction
# Entree: lib, nom de la librairie de la fonction
# fonction, nom de la fonction a rechercher
# Sortie: chaine de caracteres
def getPrototypeFonction(self, lib, fonction):
chaine = lib + fonction + ".im_func"
chaine = chaine.replace("getLibrairies().", "")
args = inspect.getargspec(eval(chaine))
args[0].remove('self')
args[0].remove('test')
prototype = fonction + inspect.formatargspec(args[0], args[1], args[2], args[3])
return (prototype, args[0], args[3])
# Retourne la chaine representant la librairie ou se trouve la fonction
# Entree: fonction, nom de la fonction a rechercher
# Sortie: chaine, si trouve
# None, si non-trouve
def getLibFonction(self, fonction):
chaine = "self.lib[i]." + fonction
for i in range(self.NB_LIB):
try:
if inspect.ismethod(eval(chaine)) or inspect.isfunction(eval(chaine)):
return "self.getLibrairies().lib[" + str(i) + "]."
except AttributeError:
pass
return '' |