WIP: Discovering: flake8 --max-line-length=80 --ignore=E402,E266, src/*.py (Merci Arthur !)
This commit is contained in:
parent
ea93bd0aad
commit
c796b06451
Binary file not shown.
|
@ -54,16 +54,16 @@ for i in lll:
|
||||||
if (i.id == j.parent):
|
if (i.id == j.parent):
|
||||||
i.add_child(j)
|
i.add_child(j)
|
||||||
|
|
||||||
print('\n', "Liste des conditions (node_id, parent_id, nb d'enfants, +/- liste des enfants)", '\n')
|
print('\n', "conditions (node_id, parent_id, nb enfants, liste enfants)", '\n')
|
||||||
|
|
||||||
affichage = ''
|
dsp = ''
|
||||||
|
|
||||||
for i in lll:
|
for i in lll:
|
||||||
affichage = str(i.id) + ' ' + str(i.parent) + ' n=' + str(len(i.ch)) + ' '
|
dsp = str(i.id) + ' ' + str(i.parent) + ' n=' + str(len(i.ch)) + ' '
|
||||||
if len(i.ch) > 0:
|
if len(i.ch) > 0:
|
||||||
for c in range(0, len(i.ch)):
|
for c in range(0, len(i.ch)):
|
||||||
affichage += str(i.ch[c].id) + ', '
|
dsp += str(i.ch[c].id) + ', '
|
||||||
print(affichage)
|
print(dsp)
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -109,11 +109,11 @@ print()
|
||||||
|
|
||||||
sp = model.testmodel.get_states().get_space(0)
|
sp = model.testmodel.get_states().get_space(0)
|
||||||
size = model.testmodel.get_parameters().spaceparam.get_dimension().get_x()
|
size = model.testmodel.get_parameters().spaceparam.get_dimension().get_x()
|
||||||
nb_sites = int(model.testmodel.get_parameters().spaceparam.get_site_multiplicity())
|
sites = int(model.testmodel.get_parameters().spaceparam.get_site_multiplicity())
|
||||||
nb_arrows = int(model.testmodel.get_states().get_space(0).get_nb_arrows())
|
nb_arrows = int(model.testmodel.get_states().get_space(0).get_nb_arrows())
|
||||||
|
|
||||||
|
|
||||||
print("space size = ", size, " nb de sites par cellule = ", nb_sites,
|
print("space size = ", size, " nb de sites par cellule = ", sites,
|
||||||
" nb total de flèches dans l'espace = ", nb_arrows)
|
" nb total de flèches dans l'espace = ", nb_arrows)
|
||||||
|
|
||||||
print(' | ', end=' ')
|
print(' | ', end=' ')
|
||||||
|
@ -129,22 +129,24 @@ print(' | ', end=' ')
|
||||||
|
|
||||||
|
|
||||||
for n in range(0, size + 1):
|
for n in range(0, size + 1):
|
||||||
for s in range(0, nb_sites):
|
for s in range(0, sites):
|
||||||
arr = 0
|
arr = 0
|
||||||
for a in range(0, nb_arrows):
|
for a in range(0, nb_arrows):
|
||||||
if (sp.get_arrow(a).get_coord("x") == n
|
if (sp.get_arrow(a).get_coord("x") == n
|
||||||
and sp.get_arrow(a).get_site() == s):
|
and sp.get_arrow(a).get_site() == s):
|
||||||
arr = sp.get_arrow(a).get_weight()
|
arr = sp.get_arrow(a).get_weight()
|
||||||
if arr > 0:
|
if arr > 0:
|
||||||
print(str(arr), end = ' ')
|
print(str(arr), end=' ')
|
||||||
else:
|
else:
|
||||||
print('.', end = ' ')
|
print('.', end=' ')
|
||||||
|
|
||||||
print(' | ', end = ' ')
|
print(' | ', end=' ')
|
||||||
|
|
||||||
print('\n ' + ' ' * nb_sites * 2, end = '')
|
print('\n ' + ' ' * sites * 2, end='')
|
||||||
|
|
||||||
|
|
||||||
for k in range(0, size + 1):
|
for k in range(0, size + 1):
|
||||||
if k < 9: print(k + 1, end=' '+ ' ' * nb_sites * 2)
|
if k < 9:
|
||||||
else: print(k + 1, end=' '+ ' ' * nb_sites * 2)
|
print(k + 1, end=' ' + ' ' * sites * 2)
|
||||||
|
else:
|
||||||
|
print(k + 1, end=' ' + ' ' * sites * 2)
|
||||||
|
|
30
src/model.py
30
src/model.py
|
@ -144,7 +144,7 @@ class Spaceparam:
|
||||||
return self.__dimension
|
return self.__dimension
|
||||||
|
|
||||||
def set_dimension(self, value):
|
def set_dimension(self, value):
|
||||||
self.__dimension = str(value) # TODO Assert
|
self.__dimension = str(value) # TODO Assert
|
||||||
|
|
||||||
|
|
||||||
class Axis:
|
class Axis:
|
||||||
|
@ -155,13 +155,14 @@ class Axis:
|
||||||
return self.node.attrib["name"]
|
return self.node.attrib["name"]
|
||||||
|
|
||||||
def set_name(self, value):
|
def set_name(self, value):
|
||||||
pass # TODO (The user can create a complete model from scratch.)
|
pass # TODO (The user can create a complete model from scratch.)
|
||||||
|
|
||||||
def get_size(self):
|
def get_size(self):
|
||||||
return int(self.node.attrib["size"])
|
return int(self.node.attrib["size"])
|
||||||
|
|
||||||
def set_size(self, value):
|
def set_size(self, value):
|
||||||
pass # TODO (The user can create a complete model from scratch.)
|
pass # TODO (The user can create a complete model from scratch.)
|
||||||
|
|
||||||
|
|
||||||
class Dimension:
|
class Dimension:
|
||||||
__axis = []
|
__axis = []
|
||||||
|
@ -173,7 +174,7 @@ class Dimension:
|
||||||
return int(self.node.get("x"))
|
return int(self.node.get("x"))
|
||||||
|
|
||||||
def set_x(self, value):
|
def set_x(self, value):
|
||||||
self.node.attrib["x"] = value # TODO Assert
|
self.node.attrib["x"] = value # TODO Assert
|
||||||
|
|
||||||
def get_y(self):
|
def get_y(self):
|
||||||
return int(self.node.get("y"))
|
return int(self.node.get("y"))
|
||||||
|
@ -183,6 +184,7 @@ class Dimension:
|
||||||
|
|
||||||
# TODO z, u, v, w,...
|
# TODO z, u, v, w,...
|
||||||
|
|
||||||
|
|
||||||
class Parameters:
|
class Parameters:
|
||||||
|
|
||||||
def __init__(self, node):
|
def __init__(self, node):
|
||||||
|
@ -228,7 +230,7 @@ class Object:
|
||||||
return self.__arrows[i]
|
return self.__arrows[i]
|
||||||
|
|
||||||
def set_arrow(self, i, value):
|
def set_arrow(self, i, value):
|
||||||
self.__arrows[i] = value # TODO Assert
|
self.__arrows[i] = value # TODO Assert
|
||||||
|
|
||||||
|
|
||||||
class Objects:
|
class Objects:
|
||||||
|
@ -244,7 +246,7 @@ class Objects:
|
||||||
return self.__objects[i]
|
return self.__objects[i]
|
||||||
|
|
||||||
def set_object(self, i, Object):
|
def set_object(self, i, Object):
|
||||||
self.__objects[i] = Object # TODO Assert
|
self.__objects[i] = Object # TODO Assert
|
||||||
|
|
||||||
## States
|
## States
|
||||||
|
|
||||||
|
@ -289,25 +291,27 @@ class TreeNode(object):
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.ch = []
|
self.ch = []
|
||||||
self.x = x
|
self.x = x
|
||||||
# TODO self.y = y,...
|
# TODO self.y = y,...
|
||||||
self.site = site
|
self.site = site
|
||||||
self.weight = weight
|
self.weight = weight
|
||||||
|
|
||||||
def id(self): return id
|
def id(self):
|
||||||
|
return id
|
||||||
|
|
||||||
def add_child(self,ch_id):
|
def add_child(self, ch_id):
|
||||||
self.ch.append(ch_id)
|
self.ch.append(ch_id)
|
||||||
self.ch = sorted(self.ch, key=id)
|
self.ch = sorted(self.ch, key=id)
|
||||||
|
|
||||||
## Conditions
|
## Conditions
|
||||||
|
|
||||||
|
|
||||||
class Condition:
|
class Condition:
|
||||||
def __init__(self, node):
|
def __init__(self, node):
|
||||||
self.node = node
|
self.node = node
|
||||||
|
|
||||||
def get_coord(self, axis):
|
def get_coord(self, axis):
|
||||||
# print(self.node.get(axis))
|
# print(self.node.get(axis))
|
||||||
return int(self.node.get(axis))
|
return int(self. node.get(axis))
|
||||||
|
|
||||||
def set_coord(self, axis, value):
|
def set_coord(self, axis, value):
|
||||||
self.node.attrib[axis] = str(value)
|
self.node.attrib[axis] = str(value)
|
||||||
|
@ -352,6 +356,7 @@ class Conditions:
|
||||||
def get_conditions_array(self):
|
def get_conditions_array(self):
|
||||||
return self.__conditions
|
return self.__conditions
|
||||||
|
|
||||||
|
|
||||||
class Transition:
|
class Transition:
|
||||||
__arrows = []
|
__arrows = []
|
||||||
|
|
||||||
|
@ -406,6 +411,7 @@ class Arrow:
|
||||||
def set_weight(self, weight):
|
def set_weight(self, weight):
|
||||||
self.node.attrib["weight"] = str(weight)
|
self.node.attrib["weight"] = str(weight)
|
||||||
|
|
||||||
|
|
||||||
class Model:
|
class Model:
|
||||||
|
|
||||||
def __init__(self, modelpath, schemapath):
|
def __init__(self, modelpath, schemapath):
|
||||||
|
@ -468,6 +474,4 @@ testmodel = Model(modelPath, schemaPath)
|
||||||
|
|
||||||
# print(testmodel.get_conditions().get_condition(0).get_weight())
|
# print(testmodel.get_conditions().get_condition(0).get_weight())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# TODO weight_max
|
# TODO weight_max
|
||||||
|
|
Loading…
Reference in New Issue