[PATCH 9 of 9 Jqplot cube] Flake8: fix errors

Nsukami Patrick ndkpatt at gmail.com
Wed Jun 12 18:28:52 CEST 2019


# HG changeset patch
# User Nsukami Patrick <ndkpatt at gmail dot com>
# Date 1560356832 0
#      Wed Jun 12 16:27:12 2019 +0000
# Node ID 2f86725fc070b70da1aae4487a0b8abea4a3ac45
# Parent  d79a1e55523d62da02e1163d7344d692b0a49ec3
Flake8: fix errors

* F821 undefined name 'xrange'
* F821 undefined name 'unicode'
* E303 too many blank lines (4)
* E713 test for membership should be 'not in'
* E712 comparison to True should be 'if cond is True:' or 'if cond:'

diff --git a/cubicweb_jqplot/views.py b/cubicweb_jqplot/views.py
--- a/cubicweb_jqplot/views.py
+++ b/cubicweb_jqplot/views.py
@@ -25,9 +25,7 @@
 from cubicweb import NoSelectableObject
 from logilab.mtconverter import xml_escape
 from logilab.common.date import datetime2ticks
-_ = unicode
-
-
+from cubicweb import _
 
 
 def filterout_nulls(abscissa, plot):
@@ -172,7 +170,7 @@
             axes = self.default_axes
         if extra is None:
             extra = self.default_extra
-        if cursor == True:
+        if cursor:
             cursor = self.default_cursor
         if cursor:
             self._cw.add_js('plugins/jqplot.cursor.min.js')
@@ -214,9 +212,9 @@
             'jqplotArgs': js_dumps(jqplot_args),
         })
         self.div_holder(divid, width, height)
-        if displayfilter and not 'fromformfilter' in self._cw.form:
+        if displayfilter and 'fromformfilter' not in self._cw.form:
             self.form_filter(divid, mainvar)
-        if displayactions and not 'fromformfilter' in self._cw.form:
+        if displayactions and 'fromformfilter' not in self._cw.form:
             self.display_actions(divid, actions)
 
     def form_filter(self, divid, mainvar):
@@ -261,7 +259,7 @@
         else:
             abscissa = [row[0] for row in self.cw_rset]
         nbcols = len(self.cw_rset.rows[0])
-        for col in xrange(1, nbcols):
+        for col in range(1, nbcols):
             yield filterout_nulls(abscissa, (row[col] for row in self.cw_rset))
 
     def get_series(self, series_options):
@@ -347,9 +345,9 @@
             'data': json_dumps([data]),
             'options': js_dumps(options)})
         self.div_holder(divid, width, height)
-        if displayfilter and not 'fromformfilter' in self._cw.form:
+        if displayfilter and 'fromformfilter' not in self._cw.form:
             self.form_filter(divid, mainvar)
-        if displayactions and not 'fromformfilter' in self._cw.form:
+        if displayactions and 'fromformfilter' not in self._cw.form:
             self.display_actions(divid, actions)
 
     def get_data(self):



More information about the cubicweb-devel mailing list