Commit 4b74e9d1 authored by Guillaume Sabbagh's avatar Guillaume Sabbagh
Browse files

Ajout de l'export csv des loi de composition

parent 877c2caf
......@@ -488,6 +488,27 @@ class Categorie:
else:
result += "X\t"
result += '\n'
if destination != None:
with open(destination, 'w', encoding="utf-8") as f:
f.write(result)
else:
print(result)
def csv_loi_de_composition(self,destination=None,sep=','):
"""Si destination == None, alors on le print sinon on l'écrit dans un fichier"""
composees = self.enumerer_toutes_composees()
fleches = list(set([e for liste in composees.values() for e in liste]))
fleches.sort(key = str)
fleches.sort(key = lambda x:len(str(x)))
result = sep+sep.join(map(str,fleches))+"\n"
for f in fleches:
result += str(f)+sep
for g in fleches:
if f.cible == g.source:
result += str(self.Composee(f, g))+sep
else:
result += "X"+sep
result = result[:-1]+'\n'
if destination != None:
with open(destination, 'w') as f:
f.write(result)
......
......@@ -19,7 +19,7 @@ class CategorieFleurieAbstraite(Categorie):
self.cat_cones_cocones = {} #{diagramme:{"cat_cones":CategorieCones,"cat_cocones":CategorieCocones}}
for obj in categorie.objets:
diag_constant = DiagrammeObjets(categorie,[obj])
diag_constant.representant = "Δ("+str(obj)+")"
diag_constant.representant = "C("+str(obj)+")"
self.diagrammes_constants[obj] = diag_constant
self.ajouter_diagramme_interet(diag_constant)
if TOUJOURS_VERIFIER_COHERENCE:
......@@ -110,5 +110,7 @@ def main():
cat_fleurie.ajouter_diagramme_interet(diag2)
cat_fleurie.transformer_graphviz(afficher_identites=True)
cat_fleurie.csv_loi_de_composition("lois de composition/loi1.csv",';')
if __name__ == '__main__':
main()
\ No newline at end of file
;(Df,f,C(B));(Df,g,C(B));(Dg,f,C(B));(Dg,g,C(B));(C(A),f,C(B));(C(A),g,C(B));(Df,IdA,C(A));(Df,IdA/f,Df);(Df,IdA/g,Dg);(Df,IdB,C(B));(Dg,IdA,C(A));(Dg,IdA/f,Df);(Dg,IdA/g,Dg);(Dg,IdB,C(B));(C(A),IdA,C(A));(C(A),IdA/f,Df);(C(A),IdA/g,Dg);(C(B),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df,IdA,C(A));(Df,IdA/f,Df);(Df,IdA/g,Dg);(Df,IdB,C(B));X;X;X;X;X;X;X;X;(Df,IdA/IdB,Df);(Df,f/IdB,C(B));X;X;(Df,IdA/f/IdB,Df);X
(Df,f/IdB,C(B));X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;(Df,f/IdB,C(B));X;X;X;X;X;X
(Dg,IdA/IdB,Dg);X;X;(Dg,f,C(B));(Dg,g,C(B));X;X;X;X;X;X;(Dg,IdA,C(A));(Dg,IdA/f,Df);(Dg,IdA/g,Dg);(Dg,IdB,C(B));X;X;X;X;X;X;(Dg,IdA/IdB,Dg);(Dg,g/IdB,C(B));X;(Dg,IdA/g/IdB,Dg)
(Dg,g/IdB,C(B));X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;(Dg,g/IdB,C(B));X;X;X;X;X;X
(Df,IdA/f/IdB,Df);(Df,f,C(B));(Df,g,C(B));X;X;X;X;(Df,IdA,C(A));(Df,IdA/f,Df);(Df,IdA/g,Dg);(Df,f/IdB,C(B));X;X;X;X;X;X;X;X;(Df,IdA/f/IdB,Df);(Df,f/IdB,C(B));X;X;(Df,IdA/f/IdB,Df);X
(Dg,IdA/g/IdB,Dg);X;X;(Dg,f,C(B));(Dg,g,C(B));X;X;X;X;X;X;(Dg,IdA,C(A));(Dg,IdA/f,Df);(Dg,IdA/g,Dg);(Dg,g/IdB,C(B));X;X;X;X;X;X;(Dg,IdA/g/IdB,Dg);(Dg,g/IdB,C(B));X;(Dg,IdA/g/IdB,Dg)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment