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.

BaseSearch   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 8
c 2
b 0
f 0
dl 0
loc 53
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 0 7 1
A search() 0 7 1
A remove() 0 7 1
A wipe() 0 7 1
A __init__() 0 3 1
A get_config() 0 11 3
1
from django.core.exceptions import ImproperlyConfigured
2
3
from simple_forums.utils import get_setting
4
5
6
class BaseSearch(object):
7
8
    # Sub-classes should override this with the settings required for
9
    # their search adapter connection. (host, port, password, etc.)
10
    REQUIRED_SETTINGS = []
11
12
    def __init__(self):
13
        """ Pull connection information from settings file """
14
        self.get_config()
15
16
    def add(self, object):
17
        """ Add the specified object to the search index.
18
19
        This must be implemented by the search backends that are sub-
20
        classes of this class.
21
        """
22
        raise NotImplementedError
23
24
    def get_config(self):
25
        """ Get configuration options from the settings file """
26
        self.connection_info = {}
27
        self.connection_settings = get_setting('search_backend', default={})
28
29
        for field in self.REQUIRED_SETTINGS:
30
            try:
31
                self.connection_info[field] = self.connection_settings[field]
32
            except KeyError:
33
                raise ImproperlyConfigured(
34
                    "Could not find '%s' in 'search_backend' setting" % field)
35
36
    def remove(self, object):
37
        """ Remove the specified object from the search index.
38
39
        This must be implemented by the search backends that are sub-
40
        classes of this class.
41
        """
42
        raise NotImplementedError
43
44
    def search(self, search_query):
45
        """ Search for the specified search query.
46
47
        This must be implemented by the search backends that are sub-
48
        classes of this class.
49
        """
50
        raise NotImplementedError
51
52
    def wipe(self):
53
        """ Wipes the search index.
54
55
        This must be implemented by the search backends that are sub-
56
        classes of this class.
57
        """
58
        raise NotImplementedError
59