[PATCH 18 of 18 Nosylist cube] Flake8: fix errors

Nsukami Patrick ndkpatt at gmail.com
Thu Jun 13 12:02:16 CEST 2019


# HG changeset patch
# User Nsukami Patrick <ndkpatt at gmail dot com>
# Date 1560419983 0
#      Thu Jun 13 09:59:43 2019 +0000
# Node ID 181ce5beadca2d9ddbe122e369c6182de3b4de5a
# Parent  43d2a90253fbc0831f10eb3966a23ce89e52ddf4
Flake8: fix errors

* F841 local variable 'entity' is assigned to but never used
* F841 local variable 'usereid' is assigned to but never used
* F401 'cubicweb.ValidationError' imported but unused
* F401 'cubicweb._' imported but unused
* E131 continuation line unaligned for hanging indent
* E122 continuation line missing indentation or outdented
* E128 continuation line under-indented for visual indent

diff --git a/cubicweb_nosylist/hooks.py b/cubicweb_nosylist/hooks.py
--- a/cubicweb_nosylist/hooks.py
+++ b/cubicweb_nosylist/hooks.py
@@ -1,4 +1,3 @@
-from cubicweb import ValidationError
 from cubicweb.server import hook
 from cubicweb.predicates import relation_possible
 
diff --git a/cubicweb_nosylist/views.py b/cubicweb_nosylist/views.py
--- a/cubicweb_nosylist/views.py
+++ b/cubicweb_nosylist/views.py
@@ -19,10 +19,7 @@
 from logilab.mtconverter import xml_escape
 from logilab.common.decorators import monkeypatch
 from logilab.common.registry import objectify_predicate
-_ = unicode
-
-
-
+from cubicweb import _
 
 _pvs = uicfg.primaryview_section
 _pvs.tag_subject_of(('*', 'interested_in', '*'), 'hidden')
@@ -43,7 +40,7 @@
     __regid__ = 'notification'
     __select__ = (component.EntityCtxComponent.__select__
                   & relation_possible('interested_in', 'object', 'CWUser',
-                                    action='add'))
+                                      action='add'))
     context = 'ctxtoolbar'
 
     def render(self, w):
@@ -77,8 +74,8 @@
             url = '#'
         w(u'<a href="%s" class="toolbarButton %s btn btn-default %s" '
           'title="%s" data-eid="%s">%s</a>' % (
-               xml_escape(url), xml_escape(icon), xml_escape(btn_style),
-            xml_escape(title), entity.eid, xml_escape(text),
+              xml_escape(url), xml_escape(icon), xml_escape(btn_style),
+              xml_escape(title), entity.eid, xml_escape(text),
            ))
 
 
@@ -151,13 +148,11 @@
         entity = self.cw_rset.get_entity(row, 2)
         if user.eid == req.user.eid:
             msg = req._(u"Click here if you don't want to receive anymore "
-                        "notification for this %(etype)s") % {
-            'etype': entity.dc_type()}
+                        "notification for this %(etype)s") % {'etype': entity.dc_type()}
         else:
             msg = req._(u"Click here if you don't want %(login)s to receive "
-                        "anymore notification for this %(etype)s") % {
-            'login': user.login,
-            'etype': entity.dc_type()}
+                        "anymore notification for this %(etype)s") % {'login': user.login,
+                                                                      'etype': entity.dc_type()}
         self.w(u'[<a title="%s" href="#" class="notificationView" '
                'data-rtype="interested_in" data-seid="%s" data-oeid="%s">-</a>]'
                % (msg, user.eid, entity.eid))
@@ -268,7 +263,7 @@
         else:
             if iirset is not None:
                 self.w(u'<h4>%s:</h4>' %
-                    self._cw._(u'interested_in_object').capitalize())
+                       self._cw._(u'interested_in_object').capitalize())
                 if iirset:
                     self.wview('oneline_user_interested_in', iirset,
                                related_entity=entity)
@@ -293,7 +288,6 @@
                                     pageid=entity._cw.pageid, arg=entity.eid)
 
     def _render(self, form, field, renderer):
-        entity = form.edited_entity
         domid = field.dom_id(form).replace(':', r'\\:')
         data = self.autocomplete_initfunc(form, field)
         form._cw.add_onload(u'$("#%s").cwautocomplete(%s, %s);'
@@ -323,7 +317,7 @@
     __regid__ = 'interested_in_form'
     __select__ = (match_user_groups('managers')
                   & relation_possible('interested_in', 'object', 'CWUser',
-                                    action='add'))
+                                      action='add'))
 
     cwtarget = 'eformframe'
     form_buttons = [fw.SubmitButton(stdmsgs.BUTTON_OK)]
diff --git a/test/unittest_nosylist.py b/test/unittest_nosylist.py
--- a/test/unittest_nosylist.py
+++ b/test/unittest_nosylist.py
@@ -30,7 +30,7 @@
 
     def test_nosylist_deletion_after_interested_in_deletion(self):
         with self.admin_access.repo_cnx() as cnx:
-            usereid = self.create_user(cnx, 'test')
+            self.create_user(cnx, 'test')
             cnx.commit()
         with self.new_access("test").repo_cnx() as cnx:
             cnx.execute('INSERT ObjectOfInterest O: O name "les gateaux"').get_entity(0, 0)



More information about the cubicweb-devel mailing list