flake8
authorArthur Lutz <arthur.lutz@logilab.fr>
Tue, 17 Jan 2017 12:09:07 +0100
changeset 369 6cf39e14ec02
parent 368 f807b073b7d3
child 370 564d5ec64f53
flake8
entities.py
schema.py
setup.py
sobjects.py
test/unittest_blog.py
uiprops.py
views/blog.py
views/boxes.py
views/entry.py
views/urlpublishing.py
--- a/entities.py	Tue Jan 17 11:55:41 2017 +0100
+++ b/entities.py	Tue Jan 17 12:09:07 2017 +0100
@@ -5,7 +5,7 @@
 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
 :license: Lesser General Public License version 2 or above - http://www.gnu.org/
 """
-__docformat__ = "restructuredtext en"
+# __docformat__ = "restructuredtext en"
 
 from logilab.common.date import todate
 
@@ -13,6 +13,8 @@
 from cubicweb.view import EntityAdapter
 from cubicweb.predicates import is_instance
 
+__docformat__ = "restructuredtext en"
+
 
 class BlogIFeedAdapter(EntityAdapter):
     __regid__ = 'IFeed'
--- a/schema.py	Tue Jan 17 11:55:41 2017 +0100
+++ b/schema.py	Tue Jan 17 12:09:07 2017 +0100
@@ -1,3 +1,5 @@
+from six import text_type as unicode
+
 try:
     from cubicweb import _
 except ImportError:
--- a/setup.py	Tue Jan 17 11:55:41 2017 +0100
+++ b/setup.py	Tue Jan 17 12:09:07 2017 +0100
@@ -20,7 +20,6 @@
 # along with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
 """Generic Setup script, takes package info from __pkginfo__.py file
 """
-__docformat__ = "restructuredtext en"
 
 import os
 import sys
@@ -31,6 +30,8 @@
     from os.path import exists, join, dirname
     from os import walk
 
+__docformat__ = "restructuredtext en"
+
 try:
     if os.environ.get('NO_SETUPTOOLS'):
         raise ImportError()  # do as there is no setuptools
--- a/sobjects.py	Tue Jan 17 11:55:41 2017 +0100
+++ b/sobjects.py	Tue Jan 17 12:09:07 2017 +0100
@@ -1,9 +1,8 @@
 # -*- coding: utf-8 -*-
 from __future__ import print_function
 
-import sys
-import re
 from datetime import datetime
+from six import text_type as unicode
 
 from lxml.html import fromstring, tostring
 
@@ -168,7 +167,7 @@
     from simplejson import loads
     data = urllib2.urlopen(
         'http://search.twitter.com/search.json?q=%s&rpp=100' % word).read()
-    results = loads(data)
+    loads(data)
     # process results
     # print results
     return []
--- a/test/unittest_blog.py	Tue Jan 17 11:55:41 2017 +0100
+++ b/test/unittest_blog.py	Tue Jan 17 12:09:07 2017 +0100
@@ -15,7 +15,7 @@
                 'BlogEntry', title=u"hop", content=u"cubicweb hop")
             blog_entry_1.cw_set(entry_of=cubicweb_blog)
             blog_entry_2 = cnx.create_entity(
-                'BlogEntry', title=u"yes",  content=u"cubicweb yes")
+                'BlogEntry', title=u"yes", content=u"cubicweb yes")
             blog_entry_2.cw_set(entry_of=cubicweb_blog)
             self.assertEqual(len(MAILBOX), 0)
             cnx.commit()
@@ -58,7 +58,7 @@
     def test_prevnext(self):
         with self.admin_access.client_cnx() as cnx:
             e1 = cnx.create_entity('BlogEntry', title=u'a', content=u'a')
-            e2 = cnx.create_entity('CWGroup', name=u'NotTheNextOfe1')
+            cnx.create_entity('CWGroup', name=u'NotTheNextOfe1')
             e3 = cnx.create_entity('BlogEntry', title=u'b', content=u'b')
             cnx.commit()
             a1 = e1.cw_adapt_to('IPrevNext')
--- a/uiprops.py	Tue Jan 17 11:55:41 2017 +0100
+++ b/uiprops.py	Tue Jan 17 12:09:07 2017 +0100
@@ -1,1 +1,1 @@
-BLOG_ICON = data('icon_blog.gif')
+BLOG_ICON = data('icon_blog.gif') # noqa
--- a/views/blog.py	Tue Jan 17 11:55:41 2017 +0100
+++ b/views/blog.py	Tue Jan 17 12:09:07 2017 +0100
@@ -4,7 +4,6 @@
 :copyright: 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
 """
-__docformat__ = "restructuredtext en"
 
 from logilab.mtconverter import xml_escape
 
@@ -13,6 +12,8 @@
 from cubicweb.web import component
 from cubicweb.web.views import uicfg, primary
 
+__docformat__ = "restructuredtext en"
+
 _pvs = uicfg.primaryview_section
 _pvdc = uicfg.primaryview_display_ctrl
 _abaa = uicfg.actionbox_appearsin_addmenu
--- a/views/boxes.py	Tue Jan 17 11:55:41 2017 +0100
+++ b/views/boxes.py	Tue Jan 17 12:09:07 2017 +0100
@@ -4,19 +4,20 @@
 :copyright: 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
 """
-__docformat__ = "restructuredtext en"
+
+from six import text_type as unicode
+
+from cubicweb import tags
+from cubicweb.predicates import (none_rset, one_line_rset, is_instance,
+                                 has_related_entities, match_view)
+from cubicweb.web import component
 
 try:
     from cubicweb import _
 except ImportError:
     _ = unicode
 
-from logilab.mtconverter import xml_escape
-
-from cubicweb import tags
-from cubicweb.predicates import (none_rset, one_line_rset, is_instance,
-                                 has_related_entities, match_view)
-from cubicweb.web import component
+__docformat__ = "restructuredtext en"
 
 
 class BlogArchivesBox(component.CtxComponent):
--- a/views/entry.py	Tue Jan 17 11:55:41 2017 +0100
+++ b/views/entry.py	Tue Jan 17 12:09:07 2017 +0100
@@ -4,12 +4,6 @@
 :copyright: 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
 """
-__docformat__ = "restructuredtext en"
-
-try:
-    from cubicweb import _
-except ImportError:
-    _ = unicode
 
 import re
 
@@ -17,6 +11,7 @@
 from datetime import datetime
 
 from six import PY2
+from six import text_type as unicode
 
 from logilab.mtconverter import xml_escape
 
@@ -26,6 +21,12 @@
 from cubicweb.web.views import uicfg
 from cubicweb.web.views import primary, baseviews, calendar, navigation, workflow
 from cubicweb.web.views.xmlrss import RSSItemView
+try:
+    from cubicweb import _
+except ImportError:
+    _ = unicode
+
+__docformat__ = "restructuredtext en"
 
 _pvs = uicfg.primaryview_section
 _pvs.tag_attribute(('BlogEntry', 'title'), 'hidden')
@@ -155,7 +156,6 @@
     def cell_call(self, row, col, **kwargs):
         entity = self.cw_rset.get_entity(row, col)
         w = self.w
-        _ = self._cw._
         w(u'<div class="post">')
         self.toolbar_components('ctxtoolbar')
         render_blogentry_title(self._cw, w, entity)
--- a/views/urlpublishing.py	Tue Jan 17 11:55:41 2017 +0100
+++ b/views/urlpublishing.py	Tue Jan 17 12:09:07 2017 +0100
@@ -1,6 +1,3 @@
-from calendar import monthrange
-from datetime import datetime
-
 from cubicweb.web.views.urlrewrite import SimpleReqRewriter, rgx
 
 
@@ -8,29 +5,35 @@
     rules = [
         # links generated by archives by date/author boxes
         (rgx('/(micro)?blog/([0-9]+)/blogentries'),
-         dict(rql='Any B,BD ORDERBY BD DESC WHERE B creation_date BD, B entry_of BL, BL eid %(eid)s' % {'eid': r'\2'},
+         dict(rql='Any B,BD ORDERBY BD DESC WHERE B creation_date BD, '
+                  'B entry_of BL, BL eid %(eid)s' % {'eid': r'\2'},
               )),
         (rgx('/(micro)?blog/([0-9]+)/blogentries/([a-z_]+)'),
-         dict(rql='Any B,BD ORDERBY BD DESC WHERE B creation_date BD, B entry_of BL, BL eid %(eid)s, '
-              'B created_by U, U login "%(user)s"' % {
-                  'eid': r'\2', 'user': r'\3'},
+         dict(rql='Any B,BD ORDERBY BD DESC WHERE B creation_date BD, '
+                  'B entry_of BL, BL eid %(eid)s, '
+                  'B created_by U, U login "%(user)s"' % {'eid': r'\2', 'user': r'\3'},
               user=r'\2')),
         (rgx('/(micro)?blog/([0-9]+)/blogentries/([0-9]{4})'),
          dict(rql='Any B,BD ORDERBY BD DESC WHERE B creation_date BD, B entry_of BL, BL eid %(eid)s'
               'HAVING YEAR(BD)= %(year)s' % {'eid': r'\2', 'year': r'\3'},
               )),
         (rgx('/(micro)?blog/([0-9]+)/blogentries/([0-9]{4})/([0-9]{2})'),
-         dict(rql='Any B,BD ORDERBY BD DESC WHERE B creation_date BD, B entry_of BL, BL eid %(eid)s '
-              'HAVING YEAR(BD)= %(year)s, MONTH(BD)=%(month)s' % {
-                  'eid': r'\2', 'year': r'\3', 'month': r'\4'},
+         dict(rql='Any B,BD ORDERBY BD DESC WHERE B creation_date BD, '
+                  'B entry_of BL, BL eid %(eid)s '
+                  'HAVING YEAR(BD)= %(year)s, MONTH(BD)=%(month)s' % {'eid': r'\2',
+                                                                      'year': r'\3',
+                                                                      'month': r'\4'},
               )),
 
         # XXX use or kill
         (rgx('/blogentry/([a-z_]+)'),
-         dict(rql='Any B,BD ORDERBY BD DESC WHERE B is BlogEntry, B creation_date BD, B created_by U, U login "%(user)s"' % {'user': r'\1'},
+         dict(rql='Any B,BD ORDERBY BD DESC WHERE B is BlogEntry, '
+                  'B creation_date BD, B created_by U, U login "%(user)s"' % {'user': r'\1'},
               user=r'\1')),
         (rgx('/blogentry/([a-z_]+)\.rss'),
-         dict(rql='Any B,BD ORDERBY BD DESC LIMIT 20 WHERE B is BlogEntry, B creation_date BD, B created_by U, U login "%(user)s"' % {'user': r'\1'}, vid='rss')),
+         dict(rql='Any B,BD ORDERBY BD DESC LIMIT 20 WHERE B is BlogEntry, '
+                  'B creation_date BD, B created_by U, U login "%(user)s"' % {'user': r'\1'},
+              vid='rss')),
 
 
         (rgx('/blogentries/([0-9]{4})'),