GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 531f41...661b81 )
by Chathan
01:10
created

SimpleSearch.search()   A

Complexity

Conditions 3

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 13
rs 9.4285
cc 3
1
from functools import reduce
2
3
from django.db.models import Q
4
5
from simple_forums import models
6
from simple_forums.backends.search import BaseSearch, SearchResultSet
7
8
9
class SimpleSearch(BaseSearch):
10
    """ Simple ORM based search """
11
12
    def add(self, object):
13
        """ Not implemented in this backend """
14
15
    def remove(self, object):
16
        """ Not implemented in this backend """
17
18
    def search(self, query_string):
19
        """ Search all thread instances for the given query string """
20
        threads = models.Thread.objects.filter(
21
            reduce(
22
                lambda q, f: q & Q(title__icontains=f),
23
                query_string.split(),
24
                Q()))
25
26
        result_set = SearchResultSet()
27
        for thread in threads:
28
            result_set.add(thread)
29
30
        return result_set
31
32
    def wipe(self):
33
        """ Not implemented in this backend """
34