Test Failed
Push — develop ( a80574...5ed66c )
by Dean
02:36
created

APSWConnectionWrapper   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 6
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
dl 0
loc 6
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A cursor() 0 5 1
1
from plugin.core.database.wrapper.base import APSWBaseWrapper
0 ignored issues
show
Bug introduced by
The name base does not seem to exist in module plugin.core.database.wrapper.
Loading history...
Configuration introduced by
Unable to import 'plugin.core.database.wrapper.base' (invalid syntax (<string>, line 36))

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
2
3
import apsw
0 ignored issues
show
Configuration introduced by
The import apsw could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
4
import logging
5
import sys
6
7
log = logging.getLogger(__name__)
8
9
10
class APSWConnectionWrapper(apsw.Connection, APSWBaseWrapper):
0 ignored issues
show
Coding Style introduced by
This class has no __init__ method.
Loading history...
11
    def cursor(self, *args, **kwargs):
12
        cursor = super(APSWConnectionWrapper, self).cursor(*args, **kwargs)
13
14
        # Return wrapped cursor
15
        return APSWCursorWrapper(self, cursor)
16
17
18
class APSWCursorWrapper(object):
19
    def __init__(self, connection, cursor):
20
        self.__connection = connection
21
        self.__cursor = cursor
22
23
    def execute(self, *args, **kwargs):
24
        try:
25
            return self.__cursor.execute(*args, **kwargs)
26
        except self.__connection.critical_errors:
27
            self.__connection.on_exception(sys.exc_info())
28
29
    def __getattr__(self, key):
30
        if key.startswith('_APSWCursorWrapper__'):
31
            return getattr(self, key)
32
33
        return getattr(self.__cursor, key)
34