[py] Make flake8 less angry with cubicweb/server/test/
authorNicola Spanti <nicola.spanti@logilab.fr>
Thu, 19 Dec 2019 15:13:10 +0100
changeset 12841 fceae84a22dd
parent 12840 d29955a6dbba
child 12842 e150ed316dfc
[py] Make flake8 less angry with cubicweb/server/test/
cubicweb/server/test/data-migractions/cubicweb_basket/schema.py
cubicweb/server/test/data-migractions/cubicweb_card/schema.py
cubicweb/server/test/data-migractions/cubicweb_comment/schema.py
cubicweb/server/test/data-migractions/cubicweb_fakecustomtype/schema.py
cubicweb/server/test/data-migractions/cubicweb_fakecustomtype/site_cubicweb.py
cubicweb/server/test/data-migractions/cubicweb_fakeemail/__pkginfo__.py
cubicweb/server/test/data-migractions/cubicweb_fakeemail/schema.py
cubicweb/server/test/data-migractions/migratedapp/cubicweb_comment/schema.py
cubicweb/server/test/data-migractions/schema.py
cubicweb/server/test/data-schemaserial/schema.py
cubicweb/server/test/data-schemaserial/site_cubicweb.py
--- a/cubicweb/server/test/data-migractions/cubicweb_basket/schema.py	Wed Dec 18 05:39:03 2019 +0100
+++ b/cubicweb/server/test/data-migractions/cubicweb_basket/schema.py	Thu Dec 19 15:13:10 2019 +0100
@@ -9,7 +9,7 @@
         'add':    ('managers', 'users',),
         'delete': ('managers', 'owners',),
         'update': ('managers', 'owners',),
-        }
+    }
 
     name = String(required=True, indexed=True, internationalizable=True,
                   maxsize=128)
--- a/cubicweb/server/test/data-migractions/cubicweb_card/schema.py	Wed Dec 18 05:39:03 2019 +0100
+++ b/cubicweb/server/test/data-migractions/cubicweb_card/schema.py	Thu Dec 19 15:13:10 2019 +0100
@@ -7,7 +7,7 @@
         'add':    ('managers', 'users'),
         'delete': ('managers', 'owners'),
         'update': ('managers', 'owners',),
-        }
+    }
 
     title = String(required=True, fulltextindexed=True, maxsize=256)
     synopsis = String(fulltextindexed=True, maxsize=512,
--- a/cubicweb/server/test/data-migractions/cubicweb_comment/schema.py	Wed Dec 18 05:39:03 2019 +0100
+++ b/cubicweb/server/test/data-migractions/cubicweb_comment/schema.py	Thu Dec 19 15:13:10 2019 +0100
@@ -10,7 +10,7 @@
         'add':    ('managers', 'users',),
         'delete': ('managers', 'owners',),
         'update': ('managers', 'owners',),
-        }
+    }
     content = RichString(required=True, fulltextindexed=True)
     comments = SubjectRelation('Comment', cardinality='1*', composite='object')
 
@@ -20,7 +20,7 @@
         'read':   ('managers', 'users', 'guests'),
         'add':    ('managers', 'users',),
         'delete': ('managers', RRQLExpression('S owned_by U'),),
-        }
+    }
     inlined = True
     composite = 'object'
     cardinality = '1*'
--- a/cubicweb/server/test/data-migractions/cubicweb_fakecustomtype/schema.py	Wed Dec 18 05:39:03 2019 +0100
+++ b/cubicweb/server/test/data-migractions/cubicweb_fakecustomtype/schema.py	Thu Dec 19 15:13:10 2019 +0100
@@ -1,7 +1,7 @@
-
 from yams.buildobjs import EntityType, make_type
 
 Numeric = make_type('Numeric')
 
+
 class Location(EntityType):
     num = Numeric(scale=10, precision=18)
--- a/cubicweb/server/test/data-migractions/cubicweb_fakecustomtype/site_cubicweb.py	Wed Dec 18 05:39:03 2019 +0100
+++ b/cubicweb/server/test/data-migractions/cubicweb_fakecustomtype/site_cubicweb.py	Thu Dec 19 15:13:10 2019 +0100
@@ -1,6 +1,5 @@
 from yams import register_base_type
 from logilab.database import get_db_helper
-from logilab.database.sqlgen import SQLExpression
 
 _NUMERIC_PARAMETERS = {'scale': 0, 'precision': None}
 register_base_type('Numeric', _NUMERIC_PARAMETERS)
@@ -14,4 +13,5 @@
     """
     return 'numeric(%s, %s)' % (rdef.precision, rdef.scale)
 
+
 pghelper.TYPE_MAPPING['Numeric'] = pg_numeric_sqltype
--- a/cubicweb/server/test/data-migractions/cubicweb_fakeemail/__pkginfo__.py	Wed Dec 18 05:39:03 2019 +0100
+++ b/cubicweb/server/test/data-migractions/cubicweb_fakeemail/__pkginfo__.py	Thu Dec 19 15:13:10 2019 +0100
@@ -13,10 +13,10 @@
 web = 'http://www.cubicweb.org/project/%s' % distname
 description = "email component for the CubicWeb framework"
 classifiers = [
-           'Environment :: Web Environment',
-           'Framework :: CubicWeb',
-           'Programming Language :: Python',
-           'Programming Language :: JavaScript',
+    'Environment :: Web Environment',
+    'Framework :: CubicWeb',
+    'Programming Language :: Python',
+    'Programming Language :: JavaScript',
 ]
 
 # used packages
@@ -35,18 +35,21 @@
 
 THIS_CUBE_DIR = join('share', 'cubicweb', 'cubes', modname)
 
+
 def listdir(dirpath):
     return [join(dirpath, fname) for fname in _listdir(dirpath)
             if fname[0] != '.' and not fname.endswith('.pyc')
             and not fname.endswith('~')
             and not isdir(join(dirpath, fname))]
 
+
 data_files = [
     # common files
     [THIS_CUBE_DIR, [fname for fname in glob('*.py') if fname != 'setup.py']],
-    ]
+]
 # check for possible extended cube layout
-for dirname in ('entities', 'views', 'sobjects', 'hooks', 'schema', 'data', 'i18n', 'migration', 'wdoc'):
+for dirname in ('entities', 'views', 'sobjects', 'hooks', 'schema', 'data',
+                'i18n', 'migration', 'wdoc'):
     if isdir(dirname):
         data_files.append([join(THIS_CUBE_DIR, dirname), listdir(dirname)])
 # Note: here, you'll need to add subdirectories if you want
--- a/cubicweb/server/test/data-migractions/cubicweb_fakeemail/schema.py	Wed Dec 18 05:39:03 2019 +0100
+++ b/cubicweb/server/test/data-migractions/cubicweb_fakeemail/schema.py	Thu Dec 19 15:13:10 2019 +0100
@@ -42,7 +42,7 @@
         'add':    ('managers', ERQLExpression('E parts X, U has_update_permission E'),),
         'delete': ('managers', ERQLExpression('E parts X, U has_update_permission E')),
         'update': ('managers', 'owners',),
-        }
+    }
 
     content  = String(fulltextindexed=True)
     content_format = String(required=True, maxsize=50)
@@ -56,28 +56,34 @@
     see_also = SubjectRelation('EmailThread')
     forked_from = SubjectRelation('EmailThread', cardinality='?*')
 
+
 class parts(RelationType):
     """ """
     fulltext_container = 'subject'
 
+
 class sender(RelationType):
     """ """
     inlined = True
 
+
 class in_thread(RelationType):
     """ """
     inlined = True
 
+
 class reply_to(RelationType):
     """ """
     inlined = True
 
+
 class generated_by(RelationType):
     """mark an entity as generated from an email"""
     cardinality = '?*'
     subject = ('TrInfo',)
     object = 'Email'
 
+
 # if comment is installed
 if 'Comment' in context.defined:
     class comment_generated_by(RelationDefinition):
--- a/cubicweb/server/test/data-migractions/migratedapp/cubicweb_comment/schema.py	Wed Dec 18 05:39:03 2019 +0100
+++ b/cubicweb/server/test/data-migractions/migratedapp/cubicweb_comment/schema.py	Thu Dec 19 15:13:10 2019 +0100
@@ -10,7 +10,7 @@
         'add':    ('managers', 'users',),
         'delete': ('managers', 'owners',),
         'update': ('managers', 'owners',),
-        }
+    }
     content = RichString(required=True, fulltextindexed=True)
     comments = SubjectRelation('Comment', cardinality='1*', composite='object')
 
@@ -20,7 +20,7 @@
         'read':   ('managers', 'users', 'guests'),
         'add':    ('managers', 'users',),
         'delete': ('managers', RRQLExpression('S owned_by U'),),
-        }
+    }
     inlined = True
     composite = 'object'
     cardinality = '1*'
--- a/cubicweb/server/test/data-migractions/schema.py	Wed Dec 18 05:39:03 2019 +0100
+++ b/cubicweb/server/test/data-migractions/schema.py	Thu Dec 19 15:13:10 2019 +0100
@@ -13,8 +13,8 @@
 # FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
 # details.
 #
-# You should have received a copy of the GNU Lesser General Public License along
-# with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Lesser General Public License
+# along with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
 
 from yams.buildobjs import (EntityType, RelationType, RelationDefinition, ComputedRelation,
                             SubjectRelation, RichString, String, Int, Float,
@@ -30,10 +30,14 @@
 class Affaire(WorkflowableEntityType):
     __permissions__ = {
         'read':   ('managers',
-                   ERQLExpression('X owned_by U'), ERQLExpression('X concerne S?, S owned_by U')),
+                   ERQLExpression('X owned_by U'),
+                   ERQLExpression('X concerne S?, S owned_by U')),
         'add':    ('managers', ERQLExpression('X concerne S, S owned_by U')),
-        'update': ('managers', 'owners', ERQLExpression('X in_state S, S name in ("pitetre", "en cours")')),
-        'delete': ('managers', 'owners', ERQLExpression('X concerne S, S owned_by U')),
+        'update': ('managers', 'owners',
+                   ERQLExpression('X in_state S, '
+                                  'S name in ("pitetre", "en cours")')),
+        'delete': ('managers', 'owners',
+                   ERQLExpression('X concerne S, S owned_by U')),
         }
 
     ref = String(fulltextindexed=True, indexed=True,
@@ -61,7 +65,7 @@
         'update': ('managers', 'owners', ERQLExpression('U login L, X nom L')),
         'delete': ('managers', 'owners', ERQLExpression('U login L, X nom L')),
         'add': ('managers', 'users',)
-        }
+    }
 
     nom  = String(maxsize=64, fulltextindexed=True)
     web  = String(maxsize=128)
@@ -79,13 +83,16 @@
 class Division(Societe):
     __specializes_schema__ = True
 
+
 class SubDivision(Division):
     __specializes_schema__ = True
 
+
 class travaille_subdivision(RelationDefinition):
     subject = 'Personne'
     object = 'SubDivision'
 
+
 from cubicweb.schemas.base import CWUser
 next(CWUser.get_relations('login')).fulltextindexed = True
 
@@ -106,10 +113,12 @@
                       })
     migrated_from = SubjectRelation('Note')
     attachment = SubjectRelation('File')
-    inline1 = SubjectRelation('Affaire', inlined=True, cardinality='?*',
-                              constraints=[RQLUniqueConstraint('S type T, S inline1 A1, A1 todo_by C, '
-                                                              'Y type T, Y inline1 A2, A2 todo_by C',
-                                                               'S,Y')])
+    inline1 = SubjectRelation(
+        'Affaire', inlined=True, cardinality='?*',
+        constraints=[
+            RQLUniqueConstraint('S type T, S inline1 A1, A1 todo_by C, '
+                                'Y type T, Y inline1 A2, A2 todo_by C',
+                                'S,Y')])
     todo_by = SubjectRelation('CWUser')
 
 
@@ -168,6 +177,7 @@
 class connait(RelationType):
     symmetric = True
 
+
 class concerne(RelationType):
     __permissions__ = {
         'read':   ('managers', 'users', 'guests'),
@@ -175,6 +185,7 @@
         'delete': ('managers', RRQLExpression('O owned_by U')),
         }
 
+
 class travaille(RelationDefinition):
     __permissions__ = {
         'read':   ('managers', 'users', 'guests'),
@@ -186,16 +197,19 @@
     constraints = [RQLVocabularyConstraint('S owned_by U'),
                    RQLVocabularyConstraint('S created_by U')]
 
+
 class comments(RelationDefinition):
     subject = 'Comment'
     object = 'Personne'
 
+
 class fiche(RelationDefinition):
     inlined = True
     subject = 'Personne'
     object = 'Card'
     cardinality = '??'
 
+
 class multisource_inlined_rel(RelationDefinition):
     inlined = True
     cardinality = '?*'
@@ -207,11 +221,13 @@
     name = 'see_also'
     subject = object = 'Folder'
 
+
 class see_also_2(RelationDefinition):
     name = 'see_also'
     subject = ('Bookmark', 'Note')
     object = ('Bookmark', 'Note')
 
+
 class evaluee(RelationDefinition):
     subject = ('Personne', 'CWUser', 'Societe')
     object = ('Note')
@@ -220,15 +236,18 @@
         RQLVocabularyConstraint('S owned_by U'),
     ]
 
+
 class ecrit_par(RelationType):
     inlined = True
 
+
 class ecrit_par_1(RelationDefinition):
     name = 'ecrit_par'
     subject = 'Note'
     object = 'Personne'
     cardinality = '?*'
 
+
 class ecrit_par_2(RelationDefinition):
     name = 'ecrit_par'
     subject = 'Note'
@@ -239,10 +258,12 @@
 class copain(RelationDefinition):
     subject = object = 'CWUser'
 
+
 class tags(RelationDefinition):
     subject = 'Tag'
     object = ('CWUser', 'CWGroup', 'State', 'Note', 'Card', 'Affaire')
 
+
 class Folder(EntityType):
     """folders are used to classify entities. They may be defined as a tree.
     """
@@ -251,23 +272,28 @@
     description = RichString(fulltextindexed=True)
     filed_under = SubjectRelation('Folder', description=_('parent folder'))
 
+
 class filed_under(RelationDefinition):
     subject = ('Note', 'Affaire')
     object = 'Folder'
 
+
 class require_permission(RelationDefinition):
     subject = ('Card', 'Note', 'Personne')
     object = 'CWPermission'
 
+
 class require_state(RelationDefinition):
     subject = 'CWPermission'
     object = 'State'
 
+
 class personne_composite(RelationDefinition):
     subject='Personne'
     object='Personne'
     composite='subject'
 
+
 class personne_inlined(RelationDefinition):
     subject='Personne'
     object='Personne'
@@ -280,6 +306,7 @@
     object = 'CWUser'
     cardinality = '??'
 
+
 class ambiguous_inlined(RelationDefinition):
     subject = ('Affaire', 'Note')
     object = 'CWUser'
--- a/cubicweb/server/test/data-schemaserial/schema.py	Wed Dec 18 05:39:03 2019 +0100
+++ b/cubicweb/server/test/data-schemaserial/schema.py	Thu Dec 19 15:13:10 2019 +0100
@@ -19,9 +19,11 @@
 from yams.buildobjs import EntityType, SubjectRelation, String, make_type
 BabarTestType = make_type('BabarTestType')
 
+
 class Affaire(EntityType):
     nom = String(unique=True, maxsize=64)
 
+
 class Personne(EntityType):
     __unique_together__ = [('nom', 'prenom', 'inline2')]
     nom    = String(fulltextindexed=True, required=True, maxsize=64)
--- a/cubicweb/server/test/data-schemaserial/site_cubicweb.py	Wed Dec 18 05:39:03 2019 +0100
+++ b/cubicweb/server/test/data-schemaserial/site_cubicweb.py	Thu Dec 19 15:13:10 2019 +0100
@@ -20,9 +20,11 @@
 from logilab.database.sqlite import register_sqlite_pyfunc
 from rql.utils import register_function
 
+
 class DUMB_SORT(FunctionDescr):
     pass
 
+
 register_function(DUMB_SORT)
 def dumb_sort(something):
     return something