| Conditions | 6 |
| Total Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | from plugin.core.database.wrapper import APSWConnectionWrapper, APSWDatabaseWrapper |
||
| 12 | def db_connect(path, type, name=None, wrapper=True): |
||
| 13 | # Connect to new database |
||
| 14 | if type == 'peewee': |
||
| 15 | # Retrieve database class |
||
| 16 | cls = APSWDatabaseWrapper if wrapper else APSWDatabase |
||
| 17 | |||
| 18 | # Construct database |
||
| 19 | db = cls(path, autorollback=True, journal_mode='WAL', timeout=BUSY_TIMEOUT) |
||
| 20 | elif type == 'raw': |
||
| 21 | # Retrieve connection class |
||
| 22 | cls = APSWConnectionWrapper if wrapper else apsw.Connection |
||
| 23 | |||
| 24 | # Construct connection |
||
| 25 | db = cls(path, flags=apsw.SQLITE_OPEN_READWRITE | apsw.SQLITE_OPEN_CREATE | apsw.SQLITE_OPEN_WAL) |
||
| 26 | db.setbusytimeout(BUSY_TIMEOUT) |
||
| 27 | else: |
||
| 28 | raise ValueError('Unknown database type: %r' % type) |
||
| 29 | |||
| 30 | # Set database name |
||
| 31 | if wrapper: |
||
| 32 | db.name = name |
||
| 33 | |||
| 34 | log.debug('Connected to database at %r', path) |
||
| 35 | return db |
||
| 36 | |||
| 46 |
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.
2. Missing __init__.py files
This error could also result from missing
__init__.pyfiles in your module folders. Make sure that you place one file in each sub-folder.