Browse Source

PEP8/Pylint on randomem.py

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

+ 6
- 7
EditorialModel/randomem.py View File

@@ -15,7 +15,7 @@ from Lodel.utils.mlstring import MlString
15 15
 
16 16
 
17 17
 class RandomEm(object):
18
-    
18
+
19 19
     ## @brief Instanciate a class allowing to generate random EM
20 20
     # @see RandomEm::random_em()
21 21
     def __init__(self, backend=None, **kwargs):
@@ -110,7 +110,7 @@ class RandomEm(object):
110 110
                         emtype.add_superior(possible[nat][i], nat)
111 111
 
112 112
         #fields creation
113
-        ft_l = [ ftname for ftname in EmField.fieldtypes_list() if ftname != 'pk' and ftname != 'rel2type']
113
+        ft_l = [ftname for ftname in EmField.fieldtypes_list() if ftname != 'pk' and ftname != 'rel2type']
114 114
         for emc in ed_mod.components('EmClass'):
115 115
             if random.randint(0, chances['nofields']) != 0:
116 116
                 for _ in range(random.randint(1, chances['nfields'])):
@@ -121,7 +121,7 @@ class RandomEm(object):
121 121
                     if random.randint(0, chances['optfield']) == 0:
122 122
                         fdats['optional'] = True
123 123
                     ed_mod.create_component('EmField', fdats)
124
-        
124
+
125 125
         #rel2type creation (in case none where created before
126 126
         for emc in ed_mod.components('EmClass'):
127 127
             for _ in range(random.randint(0, chances['nr2tfields'])):
@@ -135,9 +135,8 @@ class RandomEm(object):
135 135
                     fdats['optional'] = True
136 136
                 ed_mod.create_component('EmField', fdats)
137 137
 
138
-
139
-        #relationnal fields creation
140
-        ft_l = [field_type for field_type in EmField.fieldtypes_list() if field_type != 'rel2type' and field_type  != 'pk']
138
+        # relationnal fields creation
139
+        ft_l = [field_type for field_type in EmField.fieldtypes_list() if field_type != 'rel2type' and field_type != 'pk']
141 140
         for emrelf in [f for f in ed_mod.components(EmField) if f.fieldtype == 'rel2type']:
142 141
             for _ in range(0, chances['rfields']):
143 142
                 field_type = ft_l[random.randint(0, len(ft_l) - 1)]
@@ -151,7 +150,7 @@ class RandomEm(object):
151 150
 
152 151
         #selection optionnal fields
153 152
         for emtype in ed_mod.components(EmType):
154
-            selectable = [field  for field in emtype.em_class.fields() if field.optional]
153
+            selectable = [field for field in emtype.em_class.fields() if field.optional]
155 154
             for field in selectable:
156 155
                 if random.randint(0, chances['seltype']) == 0:
157 156
                     emtype.select_field(field)

Loading…
Cancel
Save