1 | #!/usr/bin/env python |
||
0 ignored issues
–
show
|
|||
2 | # -*- coding: utf-8 -*- |
||
3 | """A wrapper class for the mops database""" |
||
4 | import os |
||
5 | import sys |
||
6 | |||
7 | PACKAGE_PARENT = ".." |
||
8 | SCRIPT_DIR = os.path.dirname( |
||
9 | os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))) |
||
10 | ) # isort:skip # noqa # pylint: disable=wrong-import-position |
||
11 | sys.path.append( |
||
12 | os.path.normpath(os.path.join(SCRIPT_DIR, PACKAGE_PARENT)) |
||
13 | ) # isort: skip # noqa # pylint: disable=wrong-import-position |
||
14 | |||
15 | import tinydb # type: ignore # isort: skip # noqa # pylint: disable=wrong-import-position |
||
0 ignored issues
–
show
|
|||
16 | |||
17 | |||
18 | class MopsDB(): |
||
0 ignored issues
–
show
|
|||
19 | |||
20 | def __init__(self, db_path): |
||
21 | self._db = tinydb.TinyDB(db_path + "mop_db.json") |
||
22 | |||
23 | def join(self, mop): |
||
0 ignored issues
–
show
|
|||
24 | mop_key = self._db.insert(mop.__dict__) |
||
25 | mop.key = mop_key |
||
26 | self._db.update(mop, doc_key=[mop_key]) |
||
27 | return mop_key |
||
28 | |||
29 | def fetch(self, mop_key): |
||
0 ignored issues
–
show
|
|||
30 | return self._db.get(doc_key=mop_key) |
||
31 |
This check looks for invalid names for a range of different identifiers.
You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.
If your project includes a Pylint configuration file, the settings contained in that file take precedence.
To find out more about Pylint, please refer to their site.