Return-Path: X-Original-To: apmail-incubator-bloodhound-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-bloodhound-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C2D72EDAD for ; Wed, 13 Mar 2013 15:18:29 +0000 (UTC) Received: (qmail 34510 invoked by uid 500); 13 Mar 2013 15:18:29 -0000 Delivered-To: apmail-incubator-bloodhound-dev-archive@incubator.apache.org Received: (qmail 34488 invoked by uid 500); 13 Mar 2013 15:18:29 -0000 Mailing-List: contact bloodhound-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: bloodhound-dev@incubator.apache.org Delivered-To: mailing list bloodhound-dev@incubator.apache.org Received: (qmail 34476 invoked by uid 99); 13 Mar 2013 15:18:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Mar 2013 15:18:29 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of anze.staric@gmail.com designates 74.125.82.179 as permitted sender) Received: from [74.125.82.179] (HELO mail-we0-f179.google.com) (74.125.82.179) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Mar 2013 15:18:23 +0000 Received: by mail-we0-f179.google.com with SMTP id p43so1133042wea.10 for ; Wed, 13 Mar 2013 08:18:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=pwq93qSyE0Fj/RBOEafzn4+p8e9KsZbl8t7z7bdgmXQ=; b=uvnaPfkiN+A0uwHDARMS2chBAX4HEOQrgMStFNrDs4+A/qE4fyNjMGu3N8Zdv6Z6/4 CmB4NfkLzIDbyc4Ag71UIGC5mU7Lcq4Ce+4Nyt1eEdKExgz7wGVJWAWjKkUQn4P8v3GN D7pKCycpv4LkM0YHXeQmKsZwezWl2pgFihZHYWY7yHINEA3VyswLBldKW18d4ggv9c9U hTN7cjMOwyP4RtUYtg9LTijFyTnkCr08aH5ruuJ7cJtP2nL3TeMpTEKjmrrITKT1SBPX CSj+wiD3XgNDKnVMFD69gqG//JUNOuHabc8JHFoZxOLxylOehgpNtN7/rLlpvRrkJuo8 /5OA== X-Received: by 10.194.95.198 with SMTP id dm6mr186846wjb.6.1363187883490; Wed, 13 Mar 2013 08:18:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.217.1.143 with HTTP; Wed, 13 Mar 2013 08:17:43 -0700 (PDT) In-Reply-To: References: From: Anze Staric Date: Wed, 13 Mar 2013 16:17:43 +0100 Message-ID: Subject: Re: Pylint warnings in bhsearch. To: bloodhound-dev Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org (As the attachment did not make it to the mailing list, I have coppied the content of the patch to the message body). Index: bloodhound_search/bhsearch/api.py =================================================================== --- bloodhound_search/bhsearch/api.py (revision 1455913) +++ bloodhound_search/bhsearch/api.py (working copy) @@ -369,7 +369,9 @@ 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() Index: bloodhound_search/bhsearch/tests/whoosh_backend.py =================================================================== --- bloodhound_search/bhsearch/tests/whoosh_backend.py (revision 1455913) +++ bloodhound_search/bhsearch/tests/whoosh_backend.py (working copy) @@ -588,20 +588,20 @@ 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) Index: bloodhound_search/bhsearch/tests/query_parser.py =================================================================== --- bloodhound_search/bhsearch/tests/query_parser.py (revision 1455913) +++ bloodhound_search/bhsearch/tests/query_parser.py (working copy) @@ -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 @@ 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 Index: bloodhound_search/bhsearch/whoosh_backend.py =================================================================== --- bloodhound_search/bhsearch/whoosh_backend.py (revision 1455913) +++ bloodhound_search/bhsearch/whoosh_backend.py (working copy) @@ -227,7 +227,8 @@ 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 Index: bloodhound_search/bhsearch/query_parser.py =================================================================== --- bloodhound_search/bhsearch/query_parser.py (revision 1455913) +++ bloodhound_search/bhsearch/query_parser.py (working copy) @@ -131,6 +131,7 @@ 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 @@ 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 @@ implements(IMetaKeywordParser) def match(self, text, context): + # pylint: disable=unused-argument if text == u'unresolved': return u'NOT $resolved' @@ -166,5 +169,6 @@ implements(IMetaKeywordParser) def match(self, text, context): + # pylint: disable=unused-argument if text == u'my': return u'owner:$me' On Wed, Mar 13, 2013 at 4:01 PM, Anze Staric wrote: > I have noticed that the patches I have produced for bhsearch cause > some pylint warnings. Attached patch fixes the ones I could fix and > silences the rest. > > Can someone please check it out and, if it is ok, commits it? > > > Thanks, > Anze