more linting tls-sprint
authorsylvain.thenault@logilab.fr
Mon, 23 Mar 2009 18:13:34 +0100
branchtls-sprint
changeset 1133 8a409ea0c9ec
parent 1132 96752791c2b6
child 1134 f885df228fc0
more linting
devtools/_apptest.py
devtools/testlib.py
goa/__init__.py
goa/appobjects/components.py
goa/dbmyams.py
goa/goactl.py
goa/rqlinterpreter.py
schema.py
server/querier.py
server/serverconfig.py
web/form.py
web/views/plots.py
web/views/sessions.py
web/views/timetable.py
web/views/treeview.py
--- a/devtools/_apptest.py	Mon Mar 23 17:55:59 2009 +0100
+++ b/devtools/_apptest.py	Mon Mar 23 18:13:34 2009 +0100
@@ -234,15 +234,14 @@
             print "init test database ..."
         source = config.sources()['system']
         self.vreg = CubicWebRegistry(config)
-        repo, self.cnx = init_test_database(driver=source['db-driver'],
-                                            vreg=self.vreg)
+        self.cnx = init_test_database(driver=source['db-driver'],
+                                      vreg=self.vreg)[1]
         if verbose:
             print "init done" 
         self.app = CubicWebPublisher(config, vreg=self.vreg)
         self.verbose = verbose
         # this is done when the publisher is opening a connection
         self.cnx.vreg = self.vreg
-        login = source['db-user']
         
     def setup(self, config=None):
         """config is passed by TestSuite but is ignored in this environment"""
--- a/devtools/testlib.py	Mon Mar 23 17:55:59 2009 +0100
+++ b/devtools/testlib.py	Mon Mar 23 18:13:34 2009 +0100
@@ -237,7 +237,7 @@
                     output = '\n'.join(line_template % (idx + 1, line)
                                 for idx, line in enumerate(output)
                                 if line_context_filter(idx+1, position))
-                    msg+= '\nfor output:\n%s' % output
+                    msg += '\nfor output:\n%s' % output
             raise AssertionError, msg, tcbk
 
 
--- a/goa/__init__.py	Mon Mar 23 17:55:59 2009 +0100
+++ b/goa/__init__.py	Mon Mar 23 18:13:34 2009 +0100
@@ -95,7 +95,7 @@
         repository.Repository.get_cubes = get_cubes
         
         from rql import RQLHelper
-        RQLHelper.simplify = lambda x,r: None
+        RQLHelper.simplify = lambda x, r: None
 
         # activate entity caching on the server side
 
--- a/goa/appobjects/components.py	Mon Mar 23 17:55:59 2009 +0100
+++ b/goa/appobjects/components.py	Mon Mar 23 18:13:34 2009 +0100
@@ -1,13 +1,12 @@
 """overrides some base views for cubicweb on google appengine
 
 :organization: Logilab
-:copyright: 2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:copyright: 2008-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
 """
 __docformat__ = "restructuredtext en"
 
 from logilab.mtconverter import html_escape
-from logilab.common.decorators import cached
 
 from cubicweb import typed_eid
 from cubicweb.selectors import one_line_rset, match_search_state, accept
--- a/goa/dbmyams.py	Mon Mar 23 17:55:59 2009 +0100
+++ b/goa/dbmyams.py	Mon Mar 23 18:13:34 2009 +0100
@@ -168,7 +168,7 @@
     # the loader is instantiated because this is where the dbmodels
     # are registered in the yams schema
     for compname in config['included-cubes']:
-        comp = __import__('%s.schema' % compname)
+        __import__('%s.schema' % compname)
     loader = GaeSchemaLoader(use_gauthservice=config['use-google-auth'], db=db)
     loader.lib_directory = SCHEMAS_LIB_DIRECTORY
     if schemaclasses is not None:
@@ -176,7 +176,7 @@
             loader.load_dbmodel(cls.__name__, goadb.extract_dbmodel(cls))
     elif config['schema-type'] == 'dbmodel':
         import schema as appschema
-        for objname, obj in vars(appschema).items():
+        for obj in vars(appschema).values():
             if isinstance(obj, type) and issubclass(obj, goadb.Model) and obj.__module__ == appschema.__name__:
                 loader.load_dbmodel(obj.__name__, goadb.extract_dbmodel(obj))
     for erschema in ('EGroup', 'EEType', 'ERType', 'RQLExpression',
--- a/goa/goactl.py	Mon Mar 23 17:55:59 2009 +0100
+++ b/goa/goactl.py	Mon Mar 23 18:13:34 2009 +0100
@@ -214,7 +214,7 @@
         packagesdir = join(appldir, 'cubes')
         create_init_file(join(appldir, 'cubes'), 'cubes')
         cubesdir = CubicWebConfiguration.cubes_dir()
-        for include in ('addressbook', 'basket', 'blog','folder',
+        for include in ('addressbook', 'basket', 'blog', 'folder',
                         'tag', 'comment', 'file', 'link',
                         'mailinglist', 'person', 'task', 'zone',
                         ):
--- a/goa/rqlinterpreter.py	Mon Mar 23 17:55:59 2009 +0100
+++ b/goa/rqlinterpreter.py	Mon Mar 23 18:13:34 2009 +0100
@@ -6,7 +6,6 @@
 """
 __docformat__ = "restructuredtext en"
 
-from mx.DateTime import DateTimeType, DateTimeDeltaType
 from datetime import datetime
 
 from rql import RQLHelper, nodes
--- a/schema.py	Mon Mar 23 17:55:59 2009 +0100
+++ b/schema.py	Mon Mar 23 18:13:34 2009 +0100
@@ -6,9 +6,9 @@
 """
 __docformat__ = "restructuredtext en"
 
-import warnings
 import re
 from logging import getLogger
+from warnings import warn
 
 from logilab.common.decorators import cached, clear_cache, monkeypatch
 from logilab.common.compat import any
@@ -41,7 +41,6 @@
 
 def bw_normalize_etype(etype):
     if etype in ETYPE_NAME_MAP:
-        from warnings import warn
         msg = '%s has been renamed to %s, please update your code' % (
             etype, ETYPE_NAME_MAP[etype])            
         warn(msg, DeprecationWarning, stacklevel=4)
--- a/server/querier.py	Mon Mar 23 17:55:59 2009 +0100
+++ b/server/querier.py	Mon Mar 23 18:13:34 2009 +0100
@@ -13,8 +13,7 @@
 from logilab.common.compat import any
 from rql import RQLHelper, RQLSyntaxError
 from rql.stmts import Union, Select
-from rql.nodes import (Relation, VariableRef, Constant, Exists, Variable,
-                       SubQuery)
+from rql.nodes import (Relation, VariableRef, Constant, SubQuery)
 
 from cubicweb import Unauthorized, QueryError, UnknownEid, typed_eid
 from cubicweb import server
--- a/server/serverconfig.py	Mon Mar 23 17:55:59 2009 +0100
+++ b/server/serverconfig.py	Mon Mar 23 18:13:34 2009 +0100
@@ -257,7 +257,7 @@
                     print 'not connecting to source', uri, 'during migration'
         elif 'all' in sources:
             assert len(sources) == 1
-            enabled_sources= None
+            enabled_sources = None
         else:
             known_sources = self.sources()
             for uri in sources:
--- a/web/form.py	Mon Mar 23 17:55:59 2009 +0100
+++ b/web/form.py	Mon Mar 23 18:13:34 2009 +0100
@@ -17,7 +17,7 @@
 from cubicweb import typed_eid
 from cubicweb.appobject import AppObject
 from cubicweb.selectors import yes, non_final_entity
-from cubicweb.view import NOINDEX, NOFOLLOW, View
+from cubicweb.view import NOINDEX, NOFOLLOW
 from cubicweb.common import tags
 from cubicweb.web import INTERNAL_FIELD_VALUE, eid_param, stdmsgs
 from cubicweb.web.httpcache import NoHTTPCacheManager
--- a/web/views/plots.py	Mon Mar 23 17:55:59 2009 +0100
+++ b/web/views/plots.py	Mon Mar 23 18:13:34 2009 +0100
@@ -56,7 +56,7 @@
             abscisses = [row[0] for row in self.rset]
             courbes = []
             nbcols = len(self.rset.rows[0])
-            for col in range(1,nbcols):
+            for col in xrange(1, nbcols):
                 courbe = [row[col] for row in self.rset]
                 courbes.append(courbe)
             if not courbes:
@@ -71,7 +71,7 @@
             except ValueError:
                 xlabels = abscisses
                 abscisses = range(len(xlabels))
-            for idx,courbe in enumerate(courbes):
+            for idx, courbe in enumerate(courbes):
                 ax.plot(abscisses, courbe, '%sv-' % colors[idx], label=self.rset.description[0][idx+1])
             ax.autoscale_view()
             alldata = flatten(courbes)
--- a/web/views/sessions.py	Mon Mar 23 17:55:59 2009 +0100
+++ b/web/views/sessions.py	Mon Mar 23 18:13:34 2009 +0100
@@ -2,12 +2,12 @@
 object :/
 
 :organization: Logilab
-:copyright: 2001-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
 """
 __docformat__ = "restructuredtext en"
 
-from cubicweb.web import ExplicitLogin, InvalidSession
+from cubicweb.web import InvalidSession
 from cubicweb.web.application import AbstractSessionManager
 
 
--- a/web/views/timetable.py	Mon Mar 23 17:55:59 2009 +0100
+++ b/web/views/timetable.py	Mon Mar 23 18:13:34 2009 +0100
@@ -92,7 +92,7 @@
                     if key in visited_tasks:
                         task_descr = visited_tasks[ key ]
                         user_columns[task_descr.column] = task_descr, False
-                        task_descr.lines+=1
+                        task_descr.lines += 1
                     else:
                         postpone.append(key)
                 for key in postpone:
--- a/web/views/treeview.py	Mon Mar 23 17:55:59 2009 +0100
+++ b/web/views/treeview.py	Mon Mar 23 18:13:34 2009 +0100
@@ -6,21 +6,17 @@
 """
 __docformat__ = "restructuredtext en"
 
-from logilab.common.decorators import monkeypatch
 from logilab.mtconverter import html_escape
 
 from cubicweb.interfaces import ITree
 from cubicweb.selectors import implements
 from cubicweb.view import EntityView
 from cubicweb.utils import make_uid
-from cubicweb.web.views.basecontrollers import JSonController
 
 def treecookiename(treeid):
     return str('treestate-%s' % treeid)
 
 
-from cubicweb.web.views.baseviews import OneLineView
-
 class TreeView(EntityView):
     id = 'treeview'
     itemvid = 'treeitemview'