[schema] flake8
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Wed, 02 May 2018 18:07:05 +0200
changeset 192 a446efad6f9d
parent 191 cef26bcef2e2
child 193 d2577a4b0f7f
[schema] flake8
cubicweb_keyword/schema.py
--- a/cubicweb_keyword/schema.py	Wed May 02 18:06:58 2018 +0200
+++ b/cubicweb_keyword/schema.py	Wed May 02 18:07:05 2018 +0200
@@ -4,31 +4,35 @@
 :copyright: 2007-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
 """
-from yams.buildobjs import (EntityType, RelationType,
-                            SubjectRelation, ObjectRelation, String)
+from yams.buildobjs import EntityType, RelationType, SubjectRelation, String
 
-from cubicweb.schema import RQLConstraint, ERQLExpression
 from cubicweb import _
+from cubicweb.schema import RQLConstraint
 
 
 class Classification(EntityType):
     """classification schemes are used by users to classify entities.
     """
     __permissions__ = {
-        'read' : ('managers', 'users', 'guests'),
-        'add' : ('managers',),
-        'delete' : ('managers',),
-        'update' : ('managers',),
-        }
-    name = String(required=True, fulltextindexed=True, unique=True,
-                  maxsize=128)
-    classifies = SubjectRelation('CWEType',
-                     # see relation type docstring
-                     constraints = [RQLConstraint('RDEF to_entity O,'
-                                                  'RDEF relation_type R,'
-                                                  'R name "applied_to"',
-                     msg="Classification is trying to classifies an EntityType "
-                         "without applied_to relation")])
+        'read': ('managers', 'users', 'guests'),
+        'add': ('managers', ),
+        'delete': ('managers', ),
+        'update': ('managers', ),
+    }
+    name = String(required=True, fulltextindexed=True, unique=True, maxsize=128)
+    classifies = SubjectRelation(
+        'CWEType',
+        # see relation type docstring
+        constraints=[
+            RQLConstraint(
+                'RDEF to_entity O,'
+                'RDEF relation_type R,'
+                'R name "applied_to"',
+                msg="Classification is trying to classifies an EntityType "
+                "without applied_to relation"
+            )
+        ]
+    )
 
 
 class classifies(RelationType):
@@ -42,17 +46,20 @@
     and used to define a classification scheme
     """
     __permissions__ = {
-        'read' : ('managers', 'users', 'guests'),
-        'add' : ('managers', 'users'),
-        'delete' : ('managers',),
-        'update' : ('managers',),
-        }
+        'read': ('managers', 'users', 'guests'),
+        'add': ('managers', 'users'),
+        'delete': ('managers', ),
+        'update': ('managers', ),
+    }
     name = String(required=True, fulltextindexed=True, indexed=True, maxsize=128)
 
-    subkeyword_of = SubjectRelation('Keyword', cardinality='?*',
-                                    description=_('which keyword (if any) this keyword specializes'),
-                                    # if no included_in set, it'll be automatically added by a hook
-                                    constraints=[RQLConstraint('NOT S included_in CS1 OR EXISTS(S included_in CS2, O included_in CS2)')])
+    subkeyword_of = SubjectRelation(
+        'Keyword', cardinality='?*',
+        description=_('which keyword (if any) this keyword specializes'),
+        # if no included_in set, it'll be automatically added by a hook
+        constraints=[RQLConstraint(
+            'NOT S included_in CS1 OR EXISTS(S included_in CS2, O included_in CS2)'
+        )])
     descendant_of = SubjectRelation('Keyword')
     included_in = SubjectRelation('Classification', cardinality='1*')
 
@@ -63,6 +70,7 @@
     __specializes_schema__ = True
     code = String(required=True, fulltextindexed=True, indexed=True, maxsize=128)
 
+
 class subkeyword_of(RelationType):
     """a keyword can specialize another keyword"""