From c796b064517f2dcf22e94f76846b396cd94aada1 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Tue, 14 Dec 2021 20:22:30 +0100 Subject: [PATCH] WIP: Discovering: flake8 --max-line-length=80 --ignore=E402,E266, src/*.py (Merci Arthur !) --- src/__pycache__/model.cpython-39.pyc | Bin 18666 -> 18668 bytes src/glimpse.py | 30 ++++++++++++++------------- src/model.py | 30 +++++++++++++++------------ 3 files changed, 33 insertions(+), 27 deletions(-) diff --git a/src/__pycache__/model.cpython-39.pyc b/src/__pycache__/model.cpython-39.pyc index 838b6bd97902d88d231fd6f2146f5a361c293aa9..7f96f55f3023e5db69c76649b5633edcc176a87d 100644 GIT binary patch delta 1221 zcmZ`&ZETZO6yE99*UqjlEz8!8wEHMqSv&XLjXr7L*W_9QJNZrUWGtGKha zpMFGd!2!B~p9(tZJNOFk(QWwb`{*|;*q@`jXju0s-AatD%OTR>qoN3=x6$x$l7S0xSf8cd}YQ!ejG zVoRsdrRtKE7jY-ciq6st|$?5vkXejnrS0tiz*Q2C-KY1`& z?w5u*U=YjYMYI|AihlB8ydoftthoQEa8j#qWTLh*LJwl9vSam|>Xrb9M$xhT7N+UwGmJ7EV>r$*&hR$FJD4cWDjX1| zi|?5!3?1o`bt&Ti*HQ-5d*``7rU88KwooUQ-R(4q(=}#XHA~oAok~GGUA>J?;#x`; zu2pAHH-4{fG){6MJ;S>U?{P`<31RNyl6*BCrD$}LXzmG^oLvb5G^((`cDZ8Xj>HXi6J|GQp0;o>b;V@bow$czHjaDs7GKjMc59wD1f+OEhBUz^*6gF<55jBz}8%Dfw zyMARxIC4ylWF5zl>~XF6f2ra3Sm@sg1TWx)G2|xJSByOv6UMQsa(pCcEu)h%*vKYh+?S=ackl9xJUxV z7}2;y2YV)tfx1m6PA(3rLvbTZ=H}g)m?bX87&A4I=#M#L;=I)F`$+g>JSTbbp7*@p zdwZU9ejcW!VbXW%^|@K>!q@L~`eyZe%yb5E^J6rH@68E%6H!Z&=5WdKAiWKTwU=H? zAG0^3awaGjqs|!p zg}-`EHWai{&i04VQ0EtSO_cteaw-z?Knm;p&zKdJZSci`ES?uZ6u$ zNzBk@Yu9MAl|kGnvY?~lB6(n~93U^oE0Z*gJhz?vsB}L{bsC0b!)t??01>vX~q%fwc_O5+NxEVOJ6)m@4#;#Qba8(;Ag8J%bXa}xT zw@as%PnUYDs1^5lw^bbBj^{bNz+sfb7>5@*oZxVh!z&zK<-=(XGt-S9yf!*4MzU?H z#ICJF>?z5>IK>h^J ztK)En!yCMU=`=I%W} zL}&!P0gHwc@hs*WcIcL6z$1@|NY2g>N&|P%aS_Rh0ub1#TUG^+92b$Cy%A^{y&L|Y zU_oXt3w$Eo)A$xq8k?K!G?s2@nkLOW^H1Q`oeI6n7a`~Ei>vo{cf}KGx7s%kG)K`D zT#rn%ffis0w$XcHUjxBBx`0E$d)PP2_jlHzS)Ecl)p+V6DAYpdnAf6Fm3aIT_J<-8 zXIi-+LNm=8-HKRJS6I?Q+zQo7e81~e6ROggNC`!yK0<8!Q!MAw_6qtG>%$(J zM{C$FUFJtV6!Xn7a}+~i3;VCkgr_!e@hYM!mxv;g^BpL2P+Rue^5xrPn{1TVvfGef RAeYDnS 0: for c in range(0, len(i.ch)): - affichage += str(i.ch[c].id) + ', ' - print(affichage) + dsp += str(i.ch[c].id) + ', ' + print(dsp) ## @@ -109,11 +109,11 @@ print() sp = model.testmodel.get_states().get_space(0) 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()) -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) print(' | ', end=' ') @@ -129,22 +129,24 @@ print(' | ', end=' ') for n in range(0, size + 1): - for s in range(0, nb_sites): + for s in range(0, sites): arr = 0 for a in range(0, nb_arrows): if (sp.get_arrow(a).get_coord("x") == n and sp.get_arrow(a).get_site() == s): arr = sp.get_arrow(a).get_weight() if arr > 0: - print(str(arr), end = ' ') + print(str(arr), end=' ') 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): - if k < 9: print(k + 1, end=' '+ ' ' * nb_sites * 2) - else: print(k + 1, end=' '+ ' ' * nb_sites * 2) + if k < 9: + print(k + 1, end=' ' + ' ' * sites * 2) + else: + print(k + 1, end=' ' + ' ' * sites * 2) diff --git a/src/model.py b/src/model.py index c1989e1..289f39c 100644 --- a/src/model.py +++ b/src/model.py @@ -144,7 +144,7 @@ class Spaceparam: return self.__dimension def set_dimension(self, value): - self.__dimension = str(value) # TODO Assert + self.__dimension = str(value) # TODO Assert class Axis: @@ -155,13 +155,14 @@ class Axis: return self.node.attrib["name"] 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): return int(self.node.attrib["size"]) 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: __axis = [] @@ -173,7 +174,7 @@ class Dimension: return int(self.node.get("x")) def set_x(self, value): - self.node.attrib["x"] = value # TODO Assert + self.node.attrib["x"] = value # TODO Assert def get_y(self): return int(self.node.get("y")) @@ -183,6 +184,7 @@ class Dimension: # TODO z, u, v, w,... + class Parameters: def __init__(self, node): @@ -228,7 +230,7 @@ class Object: return self.__arrows[i] def set_arrow(self, i, value): - self.__arrows[i] = value # TODO Assert + self.__arrows[i] = value # TODO Assert class Objects: @@ -244,7 +246,7 @@ class Objects: return self.__objects[i] def set_object(self, i, Object): - self.__objects[i] = Object # TODO Assert + self.__objects[i] = Object # TODO Assert ## States @@ -289,25 +291,27 @@ class TreeNode(object): self.parent = parent self.ch = [] self.x = x -# TODO self.y = y,... + # TODO self.y = y,... self.site = site 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 = sorted(self.ch, key=id) ## Conditions + class Condition: def __init__(self, node): self.node = node def get_coord(self, axis): -# print(self.node.get(axis)) - return int(self.node.get(axis)) + # print(self.node.get(axis)) + return int(self. node.get(axis)) def set_coord(self, axis, value): self.node.attrib[axis] = str(value) @@ -352,6 +356,7 @@ class Conditions: def get_conditions_array(self): return self.__conditions + class Transition: __arrows = [] @@ -406,6 +411,7 @@ class Arrow: def set_weight(self, weight): self.node.attrib["weight"] = str(weight) + class Model: def __init__(self, modelpath, schemapath): @@ -468,6 +474,4 @@ testmodel = Model(modelPath, schemaPath) # print(testmodel.get_conditions().get_condition(0).get_weight()) - - # TODO weight_max