src/pyams_utils/schema.py
branchdev-tf
changeset 408 cf2304af0fab
parent 394 62a57f51fc14
child 436 f7154a8ec9eb
--- a/src/pyams_utils/schema.py	Wed Nov 20 19:26:23 2019 +0100
+++ b/src/pyams_utils/schema.py	Fri Nov 22 18:51:37 2019 +0100
@@ -10,6 +10,11 @@
 # FOR A PARTICULAR PURPOSE.
 #
 
+"""PyAMS_utils.schema module
+
+This module is used to define custom schema fields
+"""
+
 import re
 import string
 
@@ -69,10 +74,10 @@
 
     _type = None
 
-    def fromUnicode(self, str):
+    def fromUnicode(self, str):  # pylint: disable=redefined-builtin
         return str
 
-    def constraint(self, value):
+    def constraint(self, value):  # pylint: disable=method-hidden
         return True
 
 
@@ -135,8 +140,8 @@
     def _validate(self, value):
         if len(value) not in (3, 6):
             raise ValidationError(_("Color length must be 3 or 6 characters"))
-        for v in value:
-            if v not in string.hexdigits:
+        for val in value:
+            if val not in string.hexdigits:
                 raise ValidationError(_("Color value must contain only valid hexadecimal color "
                                         "codes (numbers or letters between 'A' end 'F')"))
         super(ColorField, self)._validate(value)
@@ -196,10 +201,12 @@
     """Marker interface for mail address field"""
 
 
-EMAIL_REGEX = re.compile("^[^ @]+@[^ @]+\.[^ @]+$")
+EMAIL_REGEX = re.compile(r"^[^ @]+@[^ @]+\.[^ @]+$")
 
 
 class InvalidEmail(ValidationError):
+    """Invalid email validation error"""
+
     __doc__ = _(
         "Email address must be entered as « name@domain.name », without '<' and '>' characters")