Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c1d7d30b authored by asciimoo's avatar asciimoo
Browse files

[mod] len() removed from conditions

parent 239299d4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -163,7 +163,7 @@ def score_results(results):
                duplicated = new_res
                break
        if duplicated:
            if len(res.get('content', '')) > len(duplicated.get('content', '')):  # noqa
            if res.get('content') > duplicated.get('content'):
                duplicated['content'] = res['content']
            duplicated['score'] += score
            duplicated['engines'].append(res['engine'])
+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ def parse(query):

def do_query(data, q):
    ret = []
    if not len(q):
    if not q:
        return ret

    qkey = q[0]
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ def response(resp):
        title = link.text_content()

        content = ''
        if len(result.xpath('./p[@class="desc"]')):
        if result.xpath('./p[@class="desc"]'):
            content = result.xpath('./p[@class="desc"]')[0].text_content()

        results.append({'url': url, 'title': title, 'content': content})
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ if xpath_results is a string element, then it's already done
def extract_text(xpath_results):
    if type(xpath_results) == list:
        # it's list of result : concat everything using recursive call
        if not len(xpath_results):
        if not xpath_results:
            raise Exception('Empty url resultset')
        result = ''
        for e in xpath_results:
+3 −3
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ def request(query, params):
def response(resp):
    raw_search_results = loads(resp.text)

    if not len(raw_search_results):
    if not raw_search_results:
        return []

    search_results = raw_search_results.get('channels', {})[0].get('items', [])
@@ -26,10 +26,10 @@ def response(resp):
        tmp_result['url'] = result['link']
        tmp_result['content'] = ''

        if len(result['description']):
        if result['description']:
            tmp_result['content'] += result['description'] + "<br/>"

        if len(result['pubDate']):
        if result['pubDate']:
            tmp_result['content'] += result['pubDate'] + "<br/>"

        if result['size'] != '-1':
Loading