Quellcode durchsuchen

PEP8/PyLint on fieldtype classes

Roland Haroutiounian vor 9 Jahren
Ursprung
Commit
71e588527c

+ 3
- 2
EditorialModel/fieldtypes/datetime.py Datei anzeigen

@@ -2,8 +2,9 @@
2 2
 
3 3
 from EditorialModel.fields import EmField
4 4
 
5
+
5 6
 class EmFieldDatetime(EmField):
6
-    
7
+
7 8
     ftype = 'datetime'
8 9
 
9 10
     help = 'A datetime field. Take two boolean options now_on_update and now_on_create'
@@ -11,7 +12,7 @@ class EmFieldDatetime(EmField):
11 12
     ## @brief A datetime field
12 13
     # @param now_on_update bool : If true the date is set to NOW on update
13 14
     # @param now_on_create bool : If true the date is set to NEW on creation
14
-    def __init__(self, now_on_update = False, now_on_create = False, **kwargs):
15
+    def __init__(self, now_on_update=False, now_on_create=False, **kwargs):
15 16
         self.now_on_update = now_on_update
16 17
         self.now_on_create = now_on_create
17 18
         super(EmFieldDatetime, self).__init__(**kwargs)

+ 5
- 4
EditorialModel/fieldtypes/file.py Datei anzeigen

@@ -2,15 +2,16 @@
2 2
 
3 3
 from EditorialModel.fields import EmField
4 4
 
5
+
5 6
 class EmFieldFile(EmField):
6
-    
7
+
7 8
     ftype = 'file'
8 9
     help = 'A file field. With one options upload_path'
9
-    
10
+
10 11
     ## @brief A char field
11 12
     # @brief max_length int : The maximum length of this field
12
-    def __init__(self, upload_path = None,**kwargs):
13
+    def __init__(self, upload_path=None, **kwargs):
13 14
         self.upload_path = upload_path
14 15
         super(EmFieldFile, self).__init__(**kwargs)
15 16
 
16
-fclass=EmFieldFile
17
+fclass = EmFieldFile

+ 2
- 2
EditorialModel/fieldtypes/int.py Datei anzeigen

@@ -4,7 +4,7 @@ from EditorialModel.fields import EmField
4 4
 
5 5
 
6 6
 class EmFieldInt(EmField):
7
-    
7
+
8 8
     ftype = 'int'
9 9
 
10 10
     help = 'Basic integer field'
@@ -12,4 +12,4 @@ class EmFieldInt(EmField):
12 12
     def __init__(self, **kwargs):
13 13
         super(EmFieldInt, self).__init__(**kwargs)
14 14
 
15
-fclass=EmFieldInt
15
+fclass = EmFieldInt

+ 6
- 5
EditorialModel/fieldtypes/regexchar.py Datei anzeigen

@@ -3,20 +3,21 @@
3 3
 import re
4 4
 from EditorialModel.fieldtypes.char import EmFieldChar
5 5
 
6
+
6 7
 class EmFieldCharRegex(EmFieldChar):
7 8
 
8 9
     help = 'String field validated with a regex. Take two optionss : max_length and regex'
9
-    
10
+
10 11
     ## @brief A char field validated with a regex
11 12
     # @param regex str : a regex string (passed as argument to re.compile() )
12 13
     # @param max_length int : the maximum length for this field
13
-    def __init__(self, regex = '', **kwargs):
14
+    def __init__(self, regex='', **kwargs):
14 15
         self.regex = regex
15
-        v_re = re.compile(regex) #trigger an error if invalid regex
16
+        v_re = re.compile(regex)  # trigger an error if invalid regex
16 17
 
17 18
         super(EmFieldCharRegex, self).__init__(**kwargs)
18 19
 
19
-    def validation_function(self, raise_e = None, ret_valid = None, ret_invalid = None):
20
+    def validation_function(self, raise_e=None, ret_valid=None, ret_invalid=None):
20 21
         super(EmFieldChar, self).validation_function(raise_e, ret_valid, ret_invalid)
21 22
 
22 23
         if not raise_e is None:
@@ -30,5 +31,5 @@ class EmFieldCharRegex(EmFieldChar):
30 31
                 else:
31 32
                     return ret_valid
32 33
         return v_fun
33
- 
34
+
34 35
 fclass = EmFieldCharRegex

+ 4
- 3
EditorialModel/fieldtypes/rel2type.py Datei anzeigen

@@ -2,9 +2,10 @@
2 2
 
3 3
 from EditorialModel.fields import EmField
4 4
 
5
+
5 6
 class EmFieldRel2Type(EmField):
6 7
 
7
-    ftype= 'rel2type'
8
+    ftype = 'rel2type'
8 9
 
9 10
     help = 'Relationnal field (relation2type). Take rel_to_type_id as option (an EmType uid)'
10 11
 
@@ -16,7 +17,7 @@ class EmFieldRel2Type(EmField):
16 17
         return self.model.component(self.rel_to_type_id)
17 18
 
18 19
     def get_related_fields(self):
19
-        return [ f for f in self.model.components(EmField) if f.rel_field_id == self.uid ]
20
-        
20
+        return [f for f in self.model.components(EmField) if f.rel_field_id == self.uid]
21
+
21 22
 
22 23
 fclass = EmFieldRel2Type

+ 2
- 1
EditorialModel/fieldtypes/text.py Datei anzeigen

@@ -2,8 +2,9 @@
2 2
 
3 3
 from EditorialModel.fields import EmField
4 4
 
5
+
5 6
 class EmFieldText(EmField):
6
-    
7
+
7 8
     ftype = 'text'
8 9
     help = 'A text field (big string)'
9 10
 

Laden…
Abbrechen
Speichern