Author: andrej
Date: Wed Mar 13 16:11:10 2013
New Revision: 1456017

URL: http://svn.apache.org/r1456017
Log:
adding pylint warnings in bhsearch (from Anze)

Modified:
    incubator/bloodhound/trunk/bloodhound_search/bhsearch/api.py
    incubator/bloodhound/trunk/bloodhound_search/bhsearch/query_parser.py
    incubator/bloodhound/trunk/bloodhound_search/bhsearch/tests/query_parser.py
    
incubator/bloodhound/trunk/bloodhound_search/bhsearch/tests/whoosh_backend.py
    incubator/bloodhound/trunk/bloodhound_search/bhsearch/whoosh_backend.py

Modified: incubator/bloodhound/trunk/bloodhound_search/bhsearch/api.py
URL: 
http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_search/bhsearch/api.py?rev=1456017&r1=1456016&r2=1456017&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_search/bhsearch/api.py (original)
+++ incubator/bloodhound/trunk/bloodhound_search/bhsearch/api.py Wed Mar 13 
16:11:10 2013
@@ -369,7 +369,9 @@ class BloodhoundSearchApi(Component):
         self.upgrade_environment(self.env.db_transaction)
 
     def environment_needs_upgrade(self, db):
+        # pylint: disable=unused-argument
         return self.backend.is_index_outdated()
 
     def upgrade_environment(self, db):
+        # pylint: disable=unused-argument
         self.rebuild_index()

Modified: incubator/bloodhound/trunk/bloodhound_search/bhsearch/query_parser.py
URL: 
http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_search/bhsearch/query_parser.py?rev=1456017&r1=1456016&r2=1456017&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_search/bhsearch/query_parser.py 
(original)
+++ incubator/bloodhound/trunk/bloodhound_search/bhsearch/query_parser.py Wed 
Mar 13 16:11:10 2013
@@ -131,6 +131,7 @@ class DocTypeMetaKeywordParser(Component
     search_participants = ExtensionPoint(ISearchParticipant)
 
     def match(self, text, context):
+        # pylint: disable=unused-argument
         documents = [p.get_participant_type()
                      for p in self.search_participants]
         if text in documents:
@@ -141,6 +142,7 @@ class ResolvedMetaKeywordParser(Componen
     implements(IMetaKeywordParser)
 
     def match(self, text, context):
+        # pylint: disable=unused-argument
         if text == u'resolved':
             return u'status:(resolved OR closed)'
 
@@ -149,6 +151,7 @@ class UnResolvedMetaKeywordParser(Compon
     implements(IMetaKeywordParser)
 
     def match(self, text, context):
+        # pylint: disable=unused-argument
         if text == u'unresolved':
             return u'NOT $resolved'
 
@@ -166,5 +169,6 @@ class MyMetaKeywordParser(Component):
     implements(IMetaKeywordParser)
 
     def match(self, text, context):
+        # pylint: disable=unused-argument
         if text == u'my':
             return u'owner:$me'

Modified: 
incubator/bloodhound/trunk/bloodhound_search/bhsearch/tests/query_parser.py
URL: 
http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_search/bhsearch/tests/query_parser.py?rev=1456017&r1=1456016&r2=1456017&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_search/bhsearch/tests/query_parser.py 
(original)
+++ incubator/bloodhound/trunk/bloodhound_search/bhsearch/tests/query_parser.py 
Wed Mar 13 16:11:10 2013
@@ -21,6 +21,7 @@
 import unittest
 from bhsearch.tests.base import BaseBloodhoundSearchTest
 from bhsearch.query_parser import DefaultQueryParser
+from trac.test import Mock
 from whoosh.query import terms, nary, wrappers
 
 
@@ -84,9 +85,11 @@ class MetaKeywordsParsingTestCase(BaseBl
         self.assertEqual(parsed_query, terms.Term('owner', 'username'))
 
     def _mock_context_with_username(self, username):
-        class context:
-            class req:
-                authname = username
+        context = Mock(
+            req=Mock(
+                authname=username
+            )
+        )
         return context
 
 

Modified: 
incubator/bloodhound/trunk/bloodhound_search/bhsearch/tests/whoosh_backend.py
URL: 
http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_search/bhsearch/tests/whoosh_backend.py?rev=1456017&r1=1456016&r2=1456017&view=diff
==============================================================================
--- 
incubator/bloodhound/trunk/bloodhound_search/bhsearch/tests/whoosh_backend.py 
(original)
+++ 
incubator/bloodhound/trunk/bloodhound_search/bhsearch/tests/whoosh_backend.py 
Wed Mar 13 16:11:10 2013
@@ -588,20 +588,20 @@ class WhooshFunctionalityTestCase(unitte
             w.add_document(content=u"A nice sentence with stop words.")
 
         with ix.searcher() as s:
-            query = u"with stop"
+            query_text = u"with stop"
 
             # field_names both ignore stop words
             q = MultifieldParser(['content', 'summary'],
-                                 WhooshBackend.SCHEMA).parse(query)
-            self.assertEqual(q.simplify(s).__unicode__(),
+                                 WhooshBackend.SCHEMA).parse(query_text)
+            self.assertEqual(unicode(q.simplify(s)),
                              u'((content:with OR summary:with) AND '
                              u'(content:stop OR summary:stop))')
             self.assertEqual(len(s.search(q)), 1)
 
             # 'content' and 'id' ignores stop words
             q = MultifieldParser(['content', 'id'],
-                                 WhooshBackend.SCHEMA).parse(query)
-            self.assertEqual(q.simplify(s).__unicode__(),
+                                 WhooshBackend.SCHEMA).parse(query_text)
+            self.assertEqual(unicode(q.simplify(s)),
                              u'((content:with OR id:with) AND '
                              u'(content:stop OR id:stop))')
             self.assertEqual(len(s.search(q)), 1)

Modified: 
incubator/bloodhound/trunk/bloodhound_search/bhsearch/whoosh_backend.py
URL: 
http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_search/bhsearch/whoosh_backend.py?rev=1456017&r1=1456016&r2=1456017&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_search/bhsearch/whoosh_backend.py 
(original)
+++ incubator/bloodhound/trunk/bloodhound_search/bhsearch/whoosh_backend.py Wed 
Mar 13 16:11:10 2013
@@ -227,7 +227,8 @@ class WhooshBackend(Component):
                                             highlight_fields,
                                             query_parameters)
             try:
-                results.debug['actual_query'] = 
unicode(query.simplify(searcher))
+                actual_query = unicode(query.simplify(searcher))
+                results.debug['actual_query'] = actual_query
             except TypeError:
                 # Simplify has a bug that causes it to fail sometimes.
                 pass


Reply via email to