Browse Source

PEP8/Pylint on components.py

Roland Haroutiounian 9 years ago
parent
commit
8058785023
1 changed files with 7 additions and 6 deletions
  1. 7
    6
      EditorialModel/components.py

+ 7
- 6
EditorialModel/components.py View File

10
 import EditorialModel
10
 import EditorialModel
11
 from Lodel.utils.mlstring import MlString
11
 from Lodel.utils.mlstring import MlString
12
 
12
 
13
+
13
 ## This class is the mother class of all editorial model objects
14
 ## This class is the mother class of all editorial model objects
14
 #
15
 #
15
 # It gather all the properties and mechanism that are common to every editorial model objects
16
 # It gather all the properties and mechanism that are common to every editorial model objects
70
         uname = self.__class__.__name__
71
         uname = self.__class__.__name__
71
         if not isinstance(self, EditorialModel.fields.EmField):  # WARNING this could crash with fieldtypes
72
         if not isinstance(self, EditorialModel.fields.EmField):  # WARNING this could crash with fieldtypes
72
             try:
73
             try:
73
-                uname += '_' + self.em_class.name
74
+                uname += '_' + self.em_class.name  # TODO Ajouter la propriété
74
             except AttributeError:
75
             except AttributeError:
75
                 pass
76
                 pass
76
         uname += '_' + self.name
77
         uname += '_' + self.name
144
     # @return The max rank is the rank group or -1 if no components in that group
145
     # @return The max rank is the rank group or -1 if no components in that group
145
     def get_max_rank(self):
146
     def get_max_rank(self):
146
         same_rgroup = self.same_rank_group()
147
         same_rgroup = self.same_rank_group()
147
-        return max([ comp.rank for comp in same_rgroup]) if len(same_rgroup) > 0 else -1
148
+        return max([comp.rank for comp in same_rgroup]) if len(same_rgroup) > 0 else -1
148
 
149
 
149
     ## Return an array of instances that are concerned by the same rank
150
     ## Return an array of instances that are concerned by the same rank
150
     # @return An array of instances that are concerned by the same rank
151
     # @return An array of instances that are concerned by the same rank
185
         self.model.sort_components(self.__class__)
186
         self.model.sort_components(self.__class__)
186
 
187
 
187
     ## Modify a rank given an integer modifier
188
     ## Modify a rank given an integer modifier
188
-    # @note this method always tries to make the modification : if modifier is too big put 
189
+    # @note this method always tries to make the modification : if modifier is too big put
189
     # the component in last position, if modifier is to small put the component
190
     # the component in last position, if modifier is to small put the component
190
     # in first position
191
     # in first position
191
     # @param rank_mod int : can be a negative positive or zero integer
192
     # @param rank_mod int : can be a negative positive or zero integer
197
         ret = True
198
         ret = True
198
         new_rank = self.rank + rank_mod
199
         new_rank = self.rank + rank_mod
199
         if new_rank < 1:
200
         if new_rank < 1:
200
-           ret = False
201
-           new_rank = 1
201
+            ret = False
202
+            new_rank = 1
202
         elif new_rank > self.get_max_rank():
203
         elif new_rank > self.get_max_rank():
203
             ret = False
204
             ret = False
204
             new_rank = self.get_max_rank()
205
             new_rank = self.get_max_rank()
205
-            
206
+
206
         self.set_rank(new_rank)
207
         self.set_rank(new_rank)
207
         return ret
208
         return ret
208
 
209
 

Loading…
Cancel
Save